|
|
@@ -0,0 +1,25 @@
|
|
|
+import type { MigrationLiveDefinition } from '@d8d-appcontainer/types'
|
|
|
+
|
|
|
+const createStockXunlianCodesTable: MigrationLiveDefinition = {
|
|
|
+ name: "create_stock_xunlian_codes",
|
|
|
+ up: async (api) => {
|
|
|
+ await api.schema.createTable("stock_xunlian_codes", (table) => {
|
|
|
+ table.increments("id").primary();
|
|
|
+ table.string("code").notNullable().comment("股票代码");
|
|
|
+ table.string("stock_name").notNullable().comment("股票名称");
|
|
|
+ table.string("name").notNullable().comment("案例名称");
|
|
|
+ table.string("type").nullable().comment("案例类型");
|
|
|
+ table.string("description").nullable().comment("案例描述");
|
|
|
+ table.timestamp("trade_date").notNullable().comment("交易日期");
|
|
|
+ table.timestamps(true, true);
|
|
|
+
|
|
|
+ // 添加索引
|
|
|
+ table.unique("code");
|
|
|
+ });
|
|
|
+ },
|
|
|
+ down: async (api) => {
|
|
|
+ await api.schema.dropTable("stock_xunlian_codes");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export default createStockXunlianCodesTable;
|