Explorar o código

feat(database): 新增 ocr_records 表并添加 channel 字段- 创建新的数据库迁移文件,增加 ocr_records 表
- 在 OcrRecord 模型中添加 channel 字段
- 新增字段用于记录 OCR 识别的渠道信息

wui hai 10 meses
pai
achega
f6c25a34d2

+ 3 - 0
app/Models/OcrRecord.ts

@@ -12,6 +12,9 @@ export default class OcrRecord extends AppBaseModel {
     @column()
     @column()
     public record: string
     public record: string
 
 
+    @column()
+    public channel: string
+
     @column.dateTime({ autoCreate: true })
     @column.dateTime({ autoCreate: true })
     public createdAt: DateTime
     public createdAt: DateTime
 
 

+ 0 - 19
database/migrations/1739691792622_ocr_records.ts

@@ -1,19 +0,0 @@
-import BaseSchema from '@ioc:Adonis/Lucid/Schema'
-
-export default class extends BaseSchema {
-  protected tableName = 'ocr_records'
-
-  public async up () {
-    this.schema.createTable(this.tableName, (table) => {
-        table.increments('id')
-        table.string('device_id').notNullable()
-        table.text('record').notNullable()
-        table.timestamp('created_at', { useTz: true })
-        table.timestamp('updated_at', { useTz: true })
-    })
-  }
-
-  public async down () {
-    this.schema.dropTable(this.tableName)
-  }
-}

+ 20 - 0
database/migrations/1740971717297_ocr_records.ts

@@ -0,0 +1,20 @@
+import BaseSchema from '@ioc:Adonis/Lucid/Schema'
+
+export default class extends BaseSchema {
+    protected tableName = 'ocr_records'
+
+    public async up() {
+        this.schema.createTable(this.tableName, (table) => {
+            table.increments('id')
+            table.string('device_id').notNullable()
+            table.text('record').notNullable()
+            table.string('channel').notNullable()
+            table.timestamp('created_at', { useTz: true })
+            table.timestamp('updated_at', { useTz: true })
+        })
+    }
+
+    public async down() {
+        this.schema.dropTable(this.tableName)
+    }
+}