搜索插件、代码仓与 APP 分类

插件详情v0.1.0

migrant_db_sqlite

Migrant 的 SQLite 网关

AndroidiOSLinuxmacOSWebWindows
近 30 天下载
718
喜欢数
1
Pub 分数
150

安装插件

flutter pub add migrant_db_sqlite

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Migrant_db_sqlite 是 Migrant 框架的 SQLite 数据库网关,可在多个平台间实现无缝的持久化数据存储。它提供了一种结构化的方式来管理数据库迁移和模式演进,同时利用 SQLite 的可靠性和高性能。专为 Flutter 应用设计,支持 Android、iOS、Linux、macOS、Web 和 Windows,非常适合需要强大本地数据处理能力的跨平台应用。该包与 Migrant 的迁移系统无缝集成,简化了数据库的设置和更新。

适合场景

  • 跨平台离线数据存储
  • 数据库模式版本控制
  • 移动和桌面应用程序中的应用数据持久化
  • 管理复杂的数据库迁移
  • 将 SQLite 与 Migrant 工作流集成

主要特点

  • 基于 SQLite 的迁移支持
  • 多平台兼容性
  • 与 Migrant 的无缝集成
  • 自动模式管理
  • 轻量且高效

适合对象

  • 使用 Migrant 的 Flutter 开发人员
  • 需要可靠本地数据库的应用程序
  • 具有不断演变的数据库模式的项目
  • 跨平台应用程序
  • 团队管理随时间变化的数据库变更

使用建议

  • 需要 Migrant 框架
  • 仅限 SQLite 作为后端
  • 迁移脚本必须正确定义
  • 不适用于云同步数据
  • 依赖于平台特定的 SQLite 实现

原始 README

以下为关联源码仓库的 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.
}

所属分类

依赖

依赖清单 2 项

源码仓库

使用此插件的项目

暂无相关数据。

所在榜单