migrable 0.2.1 copy "migrable: ^0.2.1" to clipboard
migrable: ^0.2.1 copied to clipboard

A easy way to build Flutter migrations.

migrable #

pub-web.flutter-io.cn

A easy way to build Flutter migrations.

The idea is to separate each of the scripts into a single migration file. Just like we do in other languages like PHP and C#. This is good for organizing the code as well as making it responsible.

So far we are only able to work with sqflite. If you want and can use it, see more about here.

We are using sqflitecon for connection management. If you don't know it yet, see more here.

Usage #

Creating migrations #

Create a Dart class in a reserved to migrations folder - like database/migrations or just migrations - and make it looks like that:

import 'package:migrable/migration.dart';
import 'package:sqflite/sqflite.dart';

class YourMigrationName implements Migration {
  @override
  void up(Batch batch) {
    batch.execute('YOUR MIGRATION SCRIPT');
  }
}

Migrating #

To call the execution of your migrations scripts include a section like that:

import 'package:migrable/migrable.dart';
import 'package:migrable/migration.dart';

List<Migration> migrations = [
    // Instances of your migration classes.
];

Migrable.execute(migrations);
1
likes
20
pub points
0%
popularity

Publisher

unverified uploader

A easy way to build Flutter migrations.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter, sqflite, sqflitecon

More

Packages that depend on migrable