feat:回退版本报错的问题

This commit is contained in:
dzc committed 2026-09-22 16:08:42 +08:00
1 parent 383ea2ad4b
commit 2d6603dfd5
10 files changed
+424 -241

No files matched your search

@@ -413,9 +413,15 @@ abstract class DatabaseMigration {
/// 版本14为打印任务补充后端指令流列,指令打印模式可离线重试且不改变出纸内容。
///
/// 列可空且不回填:旧任务与旧后端无指令,指令模式下回退 invoiceUrl 图片打印。
/// 外部存储旧库可能已带该列(中间态构建建库、降级重建),重复 ALTER 会中断启动,
/// 因此先查列再添加,保证跨版本安装可重入。
static Migration migration13To14 = Migration(13, 14, (database) async {
await database
.execute('ALTER TABLE print_history ADD COLUMN printCmd TEXT');
final columns = await database.rawQuery('PRAGMA table_info(print_history)');
final hasPrintCmd = columns.any((column) => column['name'] == 'printCmd');
if (!hasPrintCmd) {
await database
.execute('ALTER TABLE print_history ADD COLUMN printCmd TEXT');
}
});
/// 按起始版本升序返回全部迁移,Floor 打开旧数据库时据此连续升级到当前版本。