File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -111,21 +111,15 @@ void main() {
111111      await  before.customStatement ('ALTER TABLE accounts ADD extra_column int' );
112112      await  check (verifier.migrateAndValidate (
113113        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;' );
114117      await  before.close ();
115118
116119      // We need a new connection because migrations are only run when the 
117120      // database is first opened (see [DelegatedDatabase.ensureOpen]), and 
118121      // running custom statements opens it. 
119122      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- 
129123      await  verifier.migrateAndValidate (after, 2 , validateDropped:  true );
130124      await  after.close ();
131125    });
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments