出现以下错误:
2021-12-13 08:57:12.809 UTC [902] discourse@discourse ERROR: column "token" of relation "email_tokens" does not exist
2021-12-13 08:57:12.809 UTC [902] discourse@discourse STATEMENT: ALTER TABLE email_tokens ALTER COLUMN token DROP NOT NULL
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::UndefinedColumn: ERROR: column "token" of relation "email_tokens" does not exist
与此相关?:
committed 06:38AM - 13 Dec 21 UTC
This column was dropped in a previous commit, in post migrations.
Unfortunatly … that causes smoke tests to fail as there is a period between
migration and post migrations where records can not be inserted into the
table.
1 个赞
alexsts
(Alex Macmillan)
2021 年12 月 13 日 10:02
2
我们也有这个问题。
目前,我们在重建失败后成功地使用 ./launcher start app 启动了旧容器,但我们不知道数据库是否处于一致状态,因为失败发生在迁移过程中。
为了让我们安心,是否知道像这样的故障发生时,数据库迁移是否会完全回滚?
1 个赞
pfaffman
(Jay Pfaffman)
2021 年12 月 13 日 10:43
4
听起来像个 bug。我猜你没有设置 SKIP_POST_DEPLOYMENT_MIGRATIONS,对吧?
或者,也许作为一种变通方法,你可以在 app.yml 中将其设置为 1,运行重建,然后要么将其改回并再次升级,要么在容器内将其设置为零并在命令行上进行迁移。
感谢 Jay 的建议,但我似乎没有在 app.yml 中设置它。
1 个赞
david
(David Taylor)
2021 年12 月 13 日 16:08
6
请有此问题的人尝试在 rails 控制台中运行此命令,并分享您的结果:
./launcher enter app
rails c
…
DB.query "SELECT table_schema, table_name, column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name='email_tokens' AND column_name='token';"
1 个赞
david
(David Taylor)
2021 年12 月 13 日 16:15
9
好的,感谢 @aksoforever - 这证实了我的猜测。我认为这个 PR 应该能解决这个问题:
main ← fix-migration
opened 04:14PM - 13 Dec 21 UTC
We were checking for the existence of the column in any schema, including the `b… ackup` schema. This can cause 'column does not exist' errors. In fact, we should only be checking in the `public` schema.
7 个赞
david
(David Taylor)
2021 年12 月 13 日 16:21
11
该提交将在 10-15 分钟内到达 tests-passed 分支。完成后我会在这个频道通知。
3 个赞
david
(David Taylor)
2021 年12 月 13 日 16:34
12
Ok,该提交现已部署到 tests-passed 环境。
cc @aksoforever @merefield @alexsts @AquaL1te @pfaffman @TechGeek - 现在应该可以重新构建了。抱歉造成了干扰!
7 个赞