import type { MigrationLiveDefinition } from '@d8d-appcontainer/types' import { AuditStatus, DeleteStatus } from '../../client/share/types.ts' const createKnowInfoTable: MigrationLiveDefinition = { name: "create_know_info_table", up: async (api) => { await api.schema.createTable('know_info', (table) => { table.increments('id').primary(); table.string('title').comment('文章标题'); table.string('tags').comment('文章标签'); table.text('content').comment('文章内容'); table.string('author').comment('作者'); table.string('category').comment('分类'); table.string('cover_url').comment('封面图片URL'); table.integer('audit_status').defaultTo(AuditStatus.PENDING).comment('审核状态'); table.integer('sort_order').defaultTo(0).comment('排序权重'); table.integer('is_deleted').defaultTo(DeleteStatus.NOT_DELETED).comment('是否被删除 (0否 1是)'); table.timestamps(true, true); // 添加索引 table.index('title'); table.index('tags'); table.index('author'); table.index('category'); table.index('audit_status'); table.index('sort_order'); table.index('is_deleted'); }); }, down: async (api) => { await api.schema.dropTable('know_info'); } } export default createKnowInfoTable;