Skip to content

bug: sqlite migrations (upgradeStatements) are getting reapplied every time #628

@soylomass

Description

@soylomass

Plugin: SQLite

Platform: Tested in web

Description:
There's a bug in the web plugin code:

for (const upgradeStatement of upgradeStatements) {
                if (upgradeStatement.version > oldVersion ||
                    upgradeStatement.version <= newVersion) {
                    for (const sql of upgradeStatement.statements) {
                        await promiser('exec', {
                            dbId: dbId,
                            sql: sql,
                            bind: [],
                        });
                    }
                }
            }

The OR (||) in upgradeStatement.version > oldVersion || upgradeStatement.version <= newVersion means that it's always true for all migrations.

Having reviewed the code of other platforms yet.

How to solve: Change the OR by an AND.

EDIT: Seems Android and iOS implementations are correct, so the problem is only on web.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions