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

[Bug]: Broken DB migration from 25.1.0 to 25.2.1 #4406

Closed
1 task done
albanqafa opened this issue Feb 19, 2025 · 1 comment
Closed
1 task done

[Bug]: Broken DB migration from 25.1.0 to 25.2.1 #4406

albanqafa opened this issue Feb 19, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@albanqafa
Copy link

Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

i found this issue while working out a different problem with the maintainer of the Proxmox VE Helper scripts

You can see communication that lead to my finding here:
community-scripts/ProxmoxVE#2490

the problem appears that in upgrading from 25.1.0 to 25.2.1 the file migrations/1718889148000-openid.js attempts to create a new table with data from the "passwords" column of the "auth" table:

    INSERT INTO auth_new (method, display_name, extra_data, active)
      SELECT 'password', 'Password', password, 1 FROM auth;
        DROP TABLE auth;
        ALTER TABLE auth_new RENAME TO auth

but no such column exists in my db:

sqlite> .schema auth
CREATE TABLE IF NOT EXISTS "auth"
        (method TEXT PRIMARY KEY,
        display_name TEXT,
        extra_data TEXT, active INTEGER);
sqlite> 

additionally, migrations/1719409568000-multiuser.js causes a similar issue (i did not look into this as much as the one above before deleting it):

Feb 19 11:00:27 actualbudget systemd[1]: Started actualbudget.service - Actual Budget Service.
Feb 19 11:00:27 actualbudget yarn[3746]: Checking if there are any migrations to run for direction "up"...
Feb 19 11:00:27 actualbudget yarn[3746]: /opt/actualbudget/node_modules/better-sqlite3/lib/methods/wrappers.js:9
Feb 19 11:00:27 actualbudget yarn[3746]:         this[cppdb].exec(sql);
Feb 19 11:00:27 actualbudget yarn[3746]:                     ^
Feb 19 11:00:27 actualbudget yarn[3746]: SqliteError: table users already exists
Feb 19 11:00:27 actualbudget yarn[3746]:     at Database.exec (/opt/actualbudget/node_modules/better-sqlite3/lib/methods/wrappers.js:9:14)
Feb 19 11:00:27 actualbudget yarn[3746]:     at WrappedDatabase.exec (file:///opt/actualbudget/src/db.js:30:20)
Feb 19 11:00:27 actualbudget yarn[3746]:     at file:///opt/actualbudget/migrations/1719409568000-multiuser.js:8:15
Feb 19 11:00:27 actualbudget yarn[3746]:     at sqliteTransaction (/opt/actualbudget/node_modules/better-sqlite3/lib/methods/transaction.js:65:24)
Feb 19 11:00:27 actualbudget yarn[3746]:     at WrappedDatabase.transaction (file:///opt/actualbudget/src/db.js:47:35)
Feb 19 11:00:27 actualbudget yarn[3746]:     at Migration.up (file:///opt/actualbudget/migrations/1719409568000-multiuser.js:7:13)
Feb 19 11:00:27 actualbudget yarn[3746]:     at next (/opt/actualbudget/node_modules/migrate/lib/migrate.js:35:45)
Feb 19 11:00:27 actualbudget yarn[3746]:     at migrate (/opt/actualbudget/node_modules/migrate/lib/migrate.js:76:3)
Feb 19 11:00:27 actualbudget yarn[3746]:     at MigrationSet.migrate (/opt/actualbudget/node_modules/migrate/lib/set.js:123:3)
Feb 19 11:00:27 actualbudget yarn[3746]:     at MigrationSet.up (/opt/actualbudget/node_modules/migrate/lib/set.js:107:8) {
Feb 19 11:00:27 actualbudget yarn[3746]:   code: 'SQLITE_ERROR'
Feb 19 11:00:27 actualbudget yarn[3746]: }

after deleting both migrations/1718889148000-openid.js and migrations/1719409568000-multiuser.js actualbudget 25.2.1 is able to start and runs with seemingly no errors (i dont use openid or multiuser)

How can we reproduce the issue?

update actualbudget 25.1.0 to 25.2.1

Where are you hosting Actual?

Locally via Yarn

What browsers are you seeing the problem on?

No response

Operating System

Linux

@jfdoming
Copy link
Member

Please see #3957

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants