Skip to content

Initialization data problem #1984

Answered by simolus3
xqa asked this question in Q&A
Aug 11, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

So I assume that your assets/db.sqlite does not contain all of the tables that you have defined in your database schema? The easiest way to fix that would be to just add them. If that is not possible, I'd reserve a low schema version number just for the asset so that this can be recognized by drift when opening the database.

So, I would set the schema version in assets/db.sqlite to 1 (open it with sqlite3 assets/db.sqlite and run pragma user_version = 1).

Then, you set the schemaVersion getter in your database class to 2 and write a migration to add the missing tables:

  @override
  MigrationStrategy get migration {
    return MigrationStrategy(
      onUpgrade: (Migrator m, int from, int

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@xqa
Comment options

Answer selected by xqa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants