Skip to content
pubscout

migrant

0.3.0, released 2 years ago by karapetov.com

A simple Dart tool for applying database schema migrations to SQLite and PostgreSQL.

WASM-ready
$ flutter pub add migrant
Source repository

What it does

It reads migration scripts from a source (in‑memory or file system) and applies them to a target database. Separate packages provide the actual SQLite or PostgreSQL drivers. The API is minimal and focuses on sequential migration execution.

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

Use it when

  • You need to version and apply schema changes for SQLite or PostgreSQL databases in a Dart/Flutter project
  • You want a lightweight, framework‑agnostic migration runner without an ORM

Skip it when

  • You already use an ORM that includes its own migration system (e.g., drift)
  • You need advanced migration features like automatic rollbacks or complex dependency graphs

Strengths

  • Very small and easy to add
  • Works with both SQLite and PostgreSQL via companion packages
  • Supports in‑memory and filesystem migration sources

Weaknesses

  • No built‑in database drivers – you must add separate packages
  • Limited feature set compared to full‑featured migration tools
  • No code‑generation or declarative schema definitions

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0

Add migrant to pubspec and also add the appropriate source (migrant_source_fs) and database driver packages (migrant_db_sqlite or migrant_db_postgresql)

import 'package:migrant/migrant.dart';
import 'package:migrant_source_fs/migrant_source_fs.dart';
import 'package:migrant_db_sqlite/migrant_db_sqlite.dart';

final source = InMemorySource([Migration('001_create', 'CREATE TABLE foo (id INTEGER PRIMARY KEY);')]);
final db = SqliteDatabase('my.db');
final migrator = Database(source, db);
await migrator.migrate();

Alternatives

Packages that do the same job and could replace migrant.

  • drift

    Provides an integrated ORM with built‑in migration support and code generation

  • sqlparser

    Can parse and analyze SQL scripts for custom migration workflows