flutterings / sqflite_migration

Library to manage sqlite db migrations.
https://efthymis.com/migrating-a-mobile-database-in-flutter-sqlite/
Other
47 stars 18 forks source link

Cannot Add New Migrations #7

Closed charithasds closed 2 years ago

charithasds commented 4 years ago

My application is not in production yet. I had previously done some migrations and all of them worked fine. After the new update, there might be something wrong in the assertion logic which causes the issue:

error 'package:sqflite_migration/src/migrator.dart': Failed assertion: line 27 pos 12: 'config.migrationScripts.length >= newVersion': New version (2) requires 1 migrations more than what you have. during open, closing...

final List<String> initializationScripts = <String>[ 'CREATE TABLE AUTHOR_TAB(ID TEXT NOT NULL PRIMARY KEY UNIQUE, NAME TEXT NOT NULL, NAME_OTHER TEXT, FACEBOOK TEXT, WEBSITE TEXT, IS_FAVOURITE INTEGER, LAST_UPDATED TEXT NOT NULL)', ]; final List<String> migrationScripts = <String>[ 'CREATE TABLE AUTHOR_X_TAB(NAME_OTHER TEXT)', ];

This is a sample of the migration I have tried.

esarbanis commented 4 years ago

Hi @charithasds this is related to #1 which was fixed in version 0.2.0. Please try that version out and see if your issue is resolved.