Yesod를 실행하고 MySQL 데이터베이스에 액세스하고 있습니다.Yesod 데이터베이스 마이그레이션 루프
내 모델은 다음과 같습니다
Starting devel application
Migrating: ALTER TABLE `user` ALTER COLUMN `password` DROP DEFAULT
28/Mar/2017:23:46:44 +0200 [Debug#SQL] ALTER TABLE `user` ALTER COLUMN `password` DROP DEFAULT; []
devel.hs: ConnectionError {errFunction = "query", errNumber = 1101, errMessage = "BLOB/TEXT column 'password' can't have a default value"}
Unexpected: child process exited with ExitFailure 1
Trying again
Starting devel application
Migrating: ALTER TABLE `user` ALTER COLUMN `password` DROP DEFAULT
28/Mar/2017:23:46:46 +0200 [Debug#SQL] ALTER TABLE `user` ALTER COLUMN `password` DROP DEFAULT; []
devel.hs: ConnectionError {errFunction = "query", errNumber = 1101, errMessage = "BLOB/TEXT column 'password' can't have a default value"}
Unexpected: child process exited with ExitFailure 1
Trying again
그것은 끝없는 루프로 간다 :
User
ident Text
password Text Maybe
UniqueUser ident
deriving Typeable
Email
email Text
userId UserId Maybe
verkey Text Maybe
UniqueEmail email
Comment json -- Adding "json" causes ToJSON and FromJSON instances to be derived.
message Text
userId UserId Maybe
deriving Eq
deriving Show
-- By default this file is used in Model.hs (which is imported by Foundation.hs)
나는 Yesod 응용 프로그램을 실행하면 다음과 같은 반복합니다.
runLoggingT (runSqlPool (runMigration migrateAll) pool) logFunc
하지만 해결 방법을 사용하는 경우, 내가 다른 오류 얻을 :
28/Mar/2017:23:56:28 +0200 [Error#yesod-core] Foundation.hs:(137,5)-(144,45): Non-exhaustive patterns in function isAuthorized
@(yesod-core-1.4.32-6HthMZNCl0sEMRz6GJ4QO1:Yesod.Core.Class.Yesod ./Yesod/Core/Class/Yesod.hs:693:5)
28/Mar/2017:23:56:28 +0200 [Debug#SQL] SELECT `ident`,`password` FROM `user` WHERE `id`=? ; [PersistInt64 1]
GET /test
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Status: 500 Internal Server Error 0.006514s
고맙습니다! 그것을 사용하여 해결 :'alter table user modify column password varchar (255) default '';' –