|
@@ -0,0 +1,21 @@
|
|
|
|
|
+import type { MigrationLiveDefinition } from '@d8d-appcontainer/types'
|
|
|
|
|
+
|
|
|
|
|
+const createStockDataTable: MigrationLiveDefinition = {
|
|
|
|
|
+ name: "create_stock_data_table",
|
|
|
|
|
+ up: async (api) => {
|
|
|
|
|
+ await api.schema.createTable('stock_data', (table) => {
|
|
|
|
|
+ table.increments("id").primary();
|
|
|
|
|
+ table.string("code").notNullable().comment("股票代码");
|
|
|
|
|
+ table.jsonb("data").notNullable().comment("股票数据");
|
|
|
|
|
+ table.timestamps(true, true);
|
|
|
|
|
+
|
|
|
|
|
+ // 添加索引
|
|
|
|
|
+ table.unique("code");
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ down: async (api) => {
|
|
|
|
|
+ await api.schema.dropTable('stock_data');
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+export default createStockDataTable;
|