FLUTTER ECOSYSTEM

f3ath/migrant-db-sqlite

Migrant 用の SQLite ゲートウェイ

migrant_db_sqlite のプロジェクト画像
Stars
0
Forks
0
最終プッシュ(UTC)
2024/08/11
プロジェクト状態
公開中
Alexey GitHub avatar
GITHUB User

Alexey ↗

If I had ever learnt, I should have been a great proficient.

Salesforce Silicon Valley, CA
言語Dart

技術トピック

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 8 件

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

README を開く / 閉じる

SQLite gateway for migrant.

Example:

import 'package:migrant/migrant.dart';
import 'package:migrant/testing.dart';
import 'package:migrant_db_sqlite/migrant_db_sqlite.dart';
import 'package:sqflite_common/sqlite_api.dart' show inMemoryDatabasePath;
import 'package:sqflite_common_ffi/sqflite_ffi.dart' show databaseFactoryFfi;

Future<void> main() async {
  // These are the migrations. We are using a simple in-memory source,
  // but you may read them from other sources: local filesystem, network, etc.
  // More options at https://pub.dev/packages/migrant
  final migrations = InMemory([
    Migration('0001', ['CREATE TABLE foo (id TEXT NOT NULL PRIMARY KEY);']),
    Migration('0002', ['ALTER TABLE foo ADD COLUMN message TEXT;']),
    // Try adding more stuff here and running this example again.
  ]);

  // The SQLite connection. We're using a local file.
  var connection = await databaseFactoryFfi.openDatabase(inMemoryDatabasePath);

  // The gateway is provided by this package.
  final gateway = SQLiteGateway(connection);

  // Applying migrations.
  await Database(gateway).upgrade(migrations);
  // At this point the table "foo" is ready.
}