Files
d8d-admin-mobile-starter-pu…/server/migrations/007_createSystemSettingsTable.ts
2025-05-13 13:22:50 +00:00

25 lines
930 B
TypeScript

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;