File tree 1 file changed +3
-9
lines changed 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -111,21 +111,15 @@ void main() {
111
111
await before.customStatement ('ALTER TABLE accounts ADD extra_column int' );
112
112
await check (verifier.migrateAndValidate (
113
113
before, 2 , validateDropped: true )).throws <SchemaMismatch >();
114
+ // Override the schema version.
115
+ // TODO(upstream): Expose a better interface for testing this.
116
+ await before.customStatement ('PRAGMA user_version = 999;' );
114
117
await before.close ();
115
118
116
119
// We need a new connection because migrations are only run when the
117
120
// database is first opened (see [DelegatedDatabase.ensureOpen]), and
118
121
// running custom statements opens it.
119
122
final after = AppDatabase (schema.newConnection ());
120
- // Trick the drift into believing that the schema version is
121
- // higher than it actually is, so that a downgrade migration is triggered.
122
- // This relies on some relevant implementation details:
123
- // - [DelegatedDatabase._runMigrations]
124
- // - [VerifierImplementation.migrateAndValidate]
125
- // TODO(upstream): Expose a better interface for testing this.
126
- await ((after.executor as DelegatedDatabase )
127
- .delegate.versionDelegate as DynamicVersionDelegate ).setSchemaVersion (999 );
128
-
129
123
await verifier.migrateAndValidate (after, 2 , validateDropped: true );
130
124
await after.close ();
131
125
});
You can’t perform that action at this time.
0 commit comments