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;