Kaynağa Gözat

添加答题卡数据表迁移

yourname 8 ay önce
ebeveyn
işleme
72ca5194e8

+ 48 - 0
server/migrations/013_createClassroomDataTable.ts

@@ -0,0 +1,48 @@
+import type { MigrationLiveDefinition } from '@d8d-appcontainer/types'
+
+const createClassroomDataTable: MigrationLiveDefinition = {
+  name: "create_classroom_data",
+  up: async (api) => {
+     // 教室数据表
+     await api.schema.createTable('classroom_data', table => {
+        table.increments('id').primary().comment('数据ID');
+        table.string('classroom_no').nullable().comment('教室号');
+        table.timestamp('training_date').nullable().comment('训练日期');
+        table.string('holding_stock').nullable().comment('持股');
+        table.string('holding_cash').nullable().comment('持币');
+        table.string('price').nullable().comment('价格');
+        table.string('code').nullable().comment('代码');
+        table.string('status').nullable().comment('状态');
+        table.string('spare').nullable().comment('备用');
+        table.string('submit_user').nullable().comment('提交用户');
+        table.timestamps(true, true);
+    });
+
+    // 交卷记录表
+    await api.schema.createTable('submission_records', table => {
+        table.increments('id').primary().comment('数据ID');
+        table.string('classroom_no').nullable().comment('教室号');
+        table.string('user_id').nullable().comment('用户id');
+        table.string('nickname').nullable().comment('昵称');
+        table.decimal('score', 10, 2).nullable().comment('成绩');
+        table.string('code').nullable().comment('代码');
+        table.timestamp('training_date').nullable().comment('训练日期');
+        table.string('mark').nullable().comment('标记');
+        table.integer('status').nullable().comment('状态');
+        table.string('holding_stock').nullable().comment('持股');
+        table.string('holding_cash').nullable().comment('持币');
+        table.decimal('price', 10, 2).nullable().comment('价格');
+        table.decimal('profit_amount', 10, 2).nullable().comment('收益金额');
+        table.decimal('profit_percent', 10, 2).nullable().comment('收益率');
+        table.decimal('total_profit_amount', 10, 2).nullable().comment('累计收益金额');
+        table.decimal('total_profit_percent', 10, 2).nullable().comment('累计收益率');
+        table.timestamps(true, true);
+    });
+  },
+  down: async (api) => {
+    await api.schema.dropTable('submission_records');
+    await api.schema.dropTable('classroom_data');
+  }
+}
+
+export default createClassroomDataTable;

+ 2 - 0
版本迭代需求.md

@@ -1,4 +1,6 @@
 2025.05.15 0.1.1
+
+添加答题卡数据表迁移
 迁移入股票后端api
 添加股票日期备注表迁移
 添加股票历史数据表迁移