Skip to content
Library to manage sqlite db migrations.
Branch: master
Clone or download
Latest commit e33cb1a Mar 19, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example doc: add example Mar 19, 2019
lib chore: fix formatting issue Mar 19, 2019
res/values Released 0.0.1 Mar 3, 2019
test/src Remove unused argument declaration Mar 3, 2019
.flutter-plugins
.gitignore
.metadata
.travis.yml Enable travis CI Mar 2, 2019
CHANGELOG.md
LICENSE Initial Commit Mar 2, 2019
README.md
pubspec.lock Add dart documentation Mar 3, 2019
pubspec.yaml Released v0.1.0 Mar 19, 2019

README.md

Build Status codecov

Migrate your mobile sqlite database

Library to manage sqlite db migrations using sqflite plugin.

Getting Started

import 'package:path/path.dart';
import 'package:sqflite/sqflite.dart';

final initialScript = [
  '''
create table _todo_list (
  id integer primary key autoincrement,
  alias text not null
  )
''',
  '''
create table _task (
  id integer primary key autoincrement,
  description text,
  todo_list_id integer not null,
  CONSTRAINT fk_todo_lists
    FOREIGN KEY (todo_list_id)
    REFERENCES _todo_list(id)
);
'''
];

final migrations = [
  '''
  alter table _task add column done integer default 0;
  '''
];

final config = MigrationConfig(initializationScript: initialScript, migrationScripts: migrations);

Future<Database> open() async {
 final databasesPath = await getDatabasesPath();
 final path = join(databasesPath, 'test.db');
 
 return await openDatabaseWithMigration(path, config);
}
You can’t perform that action at this time.