014_createStockXunlianCodesTable.ts 949 B

12345678910111213141516171819202122232425
  1. import type { MigrationLiveDefinition } from '@d8d-appcontainer/types'
  2. const createStockXunlianCodesTable: MigrationLiveDefinition = {
  3. name: "create_stock_xunlian_codes",
  4. up: async (api) => {
  5. await api.schema.createTable("stock_xunlian_codes", (table) => {
  6. table.increments("id").primary();
  7. table.string("code").notNullable().comment("股票代码");
  8. table.string("stock_name").notNullable().comment("股票名称");
  9. table.string("name").notNullable().comment("案例名称");
  10. table.string("type").nullable().comment("案例类型");
  11. table.string("description").nullable().comment("案例描述");
  12. table.timestamp("trade_date").notNullable().comment("交易日期");
  13. table.timestamps(true, true);
  14. // 添加索引
  15. table.unique("code");
  16. });
  17. },
  18. down: async (api) => {
  19. await api.schema.dropTable("stock_xunlian_codes");
  20. }
  21. }
  22. export default createStockXunlianCodesTable;