Erreur PG lors de la reconstruction - la colonne "token" de la relation "email_tokens" n'existe pas

Getting:

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

Related to?:

1 « J'aime »

We also have this issue.

For now, we were successful in starting the old container with ./launcher start app after the failed rebuild, but we don’t know whether our database is in a consistent state since the failure occurred part-way through migration.

For our peace of mind, is it known whether the database migration is fully rolled back when a failure like this occurs?

1 « J'aime »

Same here, rolling back a backup from 8 hours ago.

Sounds like a bug. I don’t suppose that you have SKIP_POST_DEPLOYMENT_MIGRATIONS set, so you?

Or, maybe as a work around you can set it to 1 in your app.yml, run the rebuild, and then either change it back and upgrade again or inside the container, set it to zero and migrate on the command line.

Thanks for the suggestion Jay, but no, I don’t appear to have this set in app.yml.

1 « J'aime »

Please can someone with this issue try running this on the rails console, and share your result:

./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 « J'aime »

can you please have a look
seems every rebuild have this error

1 « J'aime »

Perfect, thanks @aksoforever - that confirms my suspicion. I think this PR should take care of it:

7 « J'aime »

after rebuild still have the error

seems, i need rebuild again, let me try it.

It’ll take 10-15mins for that commit to reach the tests-passed branch. I’ll post here when it’s done.

3 « J'aime »

Ok, that commit is now live in tests-passed

cc @aksoforever @merefield @alexsts @AquaL1te @pfaffman @TechGeek - a rebuild should work now. Sorry for the disruption!

7 « J'aime »

Yes, works perfect. thanks David.
very very helpful.

5 « J'aime »

This topic was automatically closed after 15 hours. New replies are no longer allowed.

Oh, great catch ! Thanks David

1 « J'aime »