Search packages, repositories and app categories

GitHub repositoryflutterings/sqflite_migration

sqflite_migration

Library to manage sqlite db migrations.

sqflite_migration project cover
Stars
47
Forks
18
Last push (UTC)
Apr 27, 2021
Project status
Active

Original README

English project snapshot. Visit GitHub for the latest content.

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';
import 'package:sqflite_migration/sqflite_migration.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);
}
flutterings GitHub avatar
GitHub author

flutterings ↗

LanguagesDart

Categories

Packages published by this repository

Dependencies used

Dependency list 5 items

  • flutter{"sdk":"flutter"}
  • sqflite^2.0.0
  • flutter_testDevelopment{"sdk":"flutter"}
  • mockitoDevelopment^5.0.0
  • matcherDevelopment^0.12.10

How do I choose a repository?

Start with your use case, compare repository activity, and check the original project before adopting it.

  1. Search by repository name, owner or description, then narrow the results by topic.
  2. Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
  3. Read the README, license and issues on GitHub before using a project.

Sources and maintenance

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗