feat:首字母查询、医院支付方、扫一扫支付
This commit is contained in:
1 parent
9c6585e245
commit
c2707899db
19 files changed
+102
-20
No files matched your search
@@ -35,7 +35,7 @@ const typeConverters = <Type>[
|
||||
BoolConverter,
|
||||
];
|
||||
|
||||
@Database(version: 1, entities: entities)
|
||||
@Database(version: 2, entities: entities)
|
||||
@TypeConverters(typeConverters)
|
||||
abstract class AppDatabase extends FloorDatabase {
|
||||
BroadcastDao get getBroadcastDao;
|
||||
@@ -51,6 +51,17 @@ abstract class AppDatabase extends FloorDatabase {
|
||||
FaceDao get getFaceDao;
|
||||
SettingDao get getSettingDao;
|
||||
|
||||
// 获取数据库迁移列表
|
||||
static List<Migration> _getDatabaseMigrations() {
|
||||
return [
|
||||
// 从版本1到版本2的迁移:添加productNamePy字段
|
||||
Migration(1, 2, (database) async {
|
||||
await database.execute(
|
||||
'ALTER TABLE supermarket_spu ADD COLUMN productNamePy TEXT');
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
static Future<AppDatabase> getDataBase() async {
|
||||
final dbPath = await AppFileTool.getDatabasePath();
|
||||
final dataBase = await $FloorAppDatabase
|
||||
@@ -68,7 +79,8 @@ abstract class AppDatabase extends FloorDatabase {
|
||||
},
|
||||
),
|
||||
)
|
||||
.addMigrations([]).build();
|
||||
.addMigrations(_getDatabaseMigrations())
|
||||
.build();
|
||||
return dataBase;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user