sqflite_migrator_plus 0.0.1 copy "sqflite_migrator_plus: ^0.0.1" to clipboard
sqflite_migrator_plus: ^0.0.1 copied to clipboard

Managing your SQFLITE migrations made a breeze in Flutter.

sqflite_migrator_plus ๐Ÿ“ฆ #

Managing your migrations with sqflite made a breeze in Flutter.

๐Ÿ“Œ Recursos #

โœ… Create and update your table structures incrementally โœ… Easy table maintenance with no worries

๐Ÿš€ Instalaรงรฃo #

Add this dependecies to you pubspec.yaml file:

dependencies:
  sqflite: ^2.4.1
  sqflite_migrator_plus: ^0.0.1

Then run the command:

flutter pub get

๐Ÿ“„ How to use it? #

Create your migrations #

import 'package:sqflite_migrator_plus/sqflite_migrator_plus.dart';

// create_table_products
class 202505091026_CreateTableProducts extends MigrationPlus {
  @override
  Future<void> execute(Database db) async {
    await db.execute('''
      CREATE TABLE products (
        id INTEGER PRIMARY KEY AUTOINCREMENT,
        product_name TEXT
      )
    ''');
  }
}

// add_price_to_products
class 202505101415_AddPriceToProducts extends MigrationPlus {
  @override
  Future<void> execute(Database db) async {
    await db.execute('ALTER TABLE products ADD COLUMN price REAL DEFAULT 0');
  }
}

final List<MigrationPlus> migrations = [
  202505091026_CreateTableProducts(),
  202505101415_AddPriceToProducts(),
];

Initialize your DB #

final dbMigratorInitializer = DbMigratorInitializer(dbName: "app_database.db", migrations: migrations);
final Database db = await dbMigratorInitializer.openAndRunMigrations();

Access your tables as usual #

await db.insert("products", {"product_name": "Smartphone", "price": 849.99});
List<Map<String, dynamic>> products = await db.query("products");
print(products);

Smart and easy #

๐Ÿ”น Don't loose your data on app updates ๐Ÿ”น Update your table schemas programmatically ๐Ÿ”น Runs needed migrtations only

Contributions #

๐Ÿ”น Make a repository fork ๐Ÿ”น Create a branch: git checkout -b my-branch ๐Ÿ”น Make a commit with your changes: git add . && git commit -m "Describe your feature" ๐Ÿ”น Upload your changes: git push origin my-branch ๐Ÿ”น Then create a Pull Request

License #

This project is licensed under MIT License - Read the file LICENSE.

Sqflite Docs GitHub Repository

0
likes
0
points
41
downloads

Publisher

unverified uploader

Weekly Downloads

Managing your SQFLITE migrations made a breeze in Flutter.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, path, sqflite

More

Packages that depend on sqflite_migrator_plus