Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/f3ath/migrant-db-sqlite
https://github.com/f3ath/migrant-db-sqlite
dart flutter migration migration-tool sqlite
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/f3ath/migrant-db-sqlite
- Owner: f3ath
- License: mit
- Created: 2022-05-05T04:33:03.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-11T00:14:17.000Z (3 months ago)
- Last Synced: 2024-08-12T00:42:35.498Z (3 months ago)
- Topics: dart, flutter, migration, migration-tool, sqlite
- Language: Dart
- Homepage: https://pub.dev/packages/migrant_db_sqlite
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
SQLite gateway for [migrant](https://pub.dev/packages/migrant).
Example:
```dart
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 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.
}
```