增加 迁移回滚功能实现

This commit is contained in:
yourname
2025-05-13 13:22:50 +00:00
parent 976e79894a
commit 8530fb5da6
13 changed files with 649 additions and 529 deletions

View File

@@ -0,0 +1,25 @@
import type { MigrationLiveDefinition } from '@d8d-appcontainer/types'
import { SystemSettingKey, SystemSettingGroup, ALLOWED_FILE_TYPES } from '../../client/share/types.ts'
const createSystemSettingsTable: MigrationLiveDefinition = {
name: "create_system_settings_table",
up: async (api) => {
await api.schema.createTable('system_settings', (table) => {
table.increments('id').primary();
table.string('key').notNullable().unique().comment('设置键');
table.text('value').notNullable().comment('设置值');
table.string('description').nullable().comment('设置描述');
table.string('group').notNullable().comment('设置分组');
table.timestamps(true, true);
// 添加索引
table.index('key');
table.index('group');
});
},
down: async (api) => {
await api.schema.dropTable('system_settings');
}
}
export default createSystemSettingsTable;