Skip to content
pubscout

sqflite_migration_plan

1.0.0, released 5 years ago by starheightmedia.com

Flexible upgrade and downgrade migrations for sqflite databases.

WASM-ready
$ flutter pub add sqflite_migration_plan
Source repository

What it does

Defines a structured migration plan with versioned lists of operations. Integrates directly into sqflite's openDatabase callback arguments for onCreate, onUpgrade, and onDowngrade.

AI-written summary of version 1.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need structured schema upgrades and downgrades for sqflite
  • You want a clear, version-mapped syntax for managing database migrations

Skip it when

  • You are using a different storage solution like Drift or plain SQL without sqflite

Strengths

  • Clear, concise syntax mapping versions to lists of migrations
  • Supports both upgrades and downgrades with reverse operations
  • Provides error handling strategies like throwing or ignoring exceptions

Weaknesses

  • Relies on sqflite and its transaction model
  • Downgrade scenarios are rarely used in production

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
2

not documented

MigrationPlan myMigrationPlan = MigrationPlan({
  2: [
    SqlMigration('CREATE TABLE my_table ( id INTEGER PRIMARY KEY )', reverseSql: 'DROP TABLE my_table')
  ]
});

Alternatives

Packages that do the same job and could replace sqflite_migration_plan.

  • drift

    A reactive SQLite library for Dart and Flutter with built-in schema migration tools and type safety.

Works with

Packages commonly used together with sqflite_migration_plan: ones it builds on, ones built on it, and its own family.