增加 迁移回滚功能实现
This commit is contained in:
25
server/migrations/007_createSystemSettingsTable.ts
Normal file
25
server/migrations/007_createSystemSettingsTable.ts
Normal 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;
|
||||
Reference in New Issue
Block a user