fix: remove foreign constraint on stack.primaryAssetId (#20052)

* fix: remove foreign constraint in stack.primaryAssetId

* fix migration

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong
2025-07-22 01:50:41 +05:30
committed by GitHub
parent 5fc4393e7a
commit 1dc62fce5f
8 changed files with 5521 additions and 126 deletions
@@ -72,7 +72,7 @@ class Drift extends $Drift implements IDatabaseRepository {
);
@override
int get schemaVersion => 2;
int get schemaVersion => 3;
@override
MigrationStrategy get migration => MigrationStrategy(
@@ -84,12 +84,16 @@ class Drift extends $Drift implements IDatabaseRepository {
from: from,
to: to,
steps: migrationSteps(
from1To2: (m, _) async {
for (final entity in allSchemaEntities) {
from1To2: (m, v2) async {
for (final entity in v2.entities) {
await m.drop(entity);
await m.create(entity);
}
},
from2To3: (m, v3) async {
// Removed foreign key constraint on stack.primaryAssetId
await m.alterTable(TableMigration(v3.stackEntity));
},
),
);