Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SELF-HOSTED] Error migrations when upgrading from 1.2.0 into 1.2.1 #1309

Open
tristanrobert opened this issue Nov 15, 2024 · 4 comments
Open

Comments

@tristanrobert
Copy link
Contributor

tristanrobert commented Nov 15, 2024

Describe the problem

INSERT INTO "migrations"("timestamp", "name") VALUES ($1, $2)',
parameters: [ 1727747249153, 'Configs1727747249153' ],
driverError: error: duplicated key violating constraint key « PK_8c82d7f526340ab734260ea46be » id 36 already exists (migration name: ActivationEnabled1722529827161

'ALTER TABLE "activations" ADD "enabled_at" TIMESTAMP WITH TIME ZONE',
driverError: error: column « enabled_at »from relation « activations » already exists

Additional information

  • Grist version: 1.2.0
  • Grist instance URL: self hosted
  • SSO solution used and its version (if relevant):
  • S3 storage solution and its version (if relevant):
  • Docker version (if relevant):
  • NodeJS version (if relevant):
  • Redis version (if relevant):
  • PostgreSQL version (if relevant):
@paulfitz
Copy link
Member

Do you think you could read out the migrations table in your home DB? On a default installation, this would be a persisted file called home.sqlite3. You could read it out with a tool such as sqlite3:

paulfitz@entwash:/tmp/example$ sqlite3 home.sqlite3 "select * from migrations"
1|1536634251710|Initial1536634251710
2|1539031763952|Login1539031763952
3|1549313797109|PinDocs1549313797109
...
30|1678737195050|ForkIndexes1678737195050
31|1682636695021|ActivationPrefs1682636695021
32|1685343047786|AssistantLimit1685343047786
33|1701557445716|Shares1701557445716
34|1711557445716|Billing1711557445716
35|1713186031023|UserLastConnection1713186031023
36|1722529827161|ActivationEnabled1722529827161
37|1727747249153|Configs1727747249153
38|1729754662550|LoginsEmailsIndex1729754662550

@paulfitz
Copy link
Member

I just tried a full replication, running a container based on the Grist docker image tagged 1.2.0, and then switching to 1.2.1. The migrations table seemed to update in an orderly fashion, with two more rows getting added:

paulfitz@entwash:/tmp/test$ diff /tmp/v1.2.0 /tmp/v1.2.1 
36a37,38
> 37|1727747249153|Configs1727747249153
> 38|1729754662550|LoginsEmailsIndex1729754662550

The id 36 already exists (migration name: ActivationEnabled1722529827161) message in your output troubles me, it reads like for some reason the ActivationEnabled migration is being run again.

@tristanrobert
Copy link
Contributor Author

home.sqlite3 is replaced by PostgreSQL database. The migrations table have already a line with id 36 and name ActivationEnabled1722529827161. So it was already enabled. I had to delete this record and remove the enable_at column in activations table before pull grist 1.2.1 docker image.

@paulfitz
Copy link
Member

Hmm. Not sure why it would attempt to run ActivationEnabled1722529827161 again if the migrations log clearly showed it had already run. Haven't seen that happen before. Will leave this issue open in case others have a similar problem and this encourages them to report it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants