| 1234567891011121314151617181920212223242526272829303132333435 |
- import type { MigrationLiveDefinition } from '@d8d-appcontainer/types'
- const addWorkOrderFields: MigrationLiveDefinition = {
- name: 'add_work_order_fields',
- up: async (api) => {
- await api.schema.alterTable('work_orders', (table) => {
- table.string('order_no').nullable().comment('工单编号');
- table.integer('device_id').unsigned().nullable().comment('设备ID')
- .references('id').inTable('device_instances').onDelete('SET NULL');
- table.string('device_name').nullable().comment('设备名称');
- table.text('problem_desc').nullable().comment('问题描述');
- table.string('problem_type').nullable().comment('问题分类');
- table.text('feedback').nullable().comment('结果反馈');
- table.timestamp('deadline').nullable().comment('截止日期');
-
- table.index('order_no');
- table.index('device_id');
- table.index('problem_type');
- });
- },
- down: async (api) => {
- await api.schema.alterTable('work_orders', (table) => {
- table.dropColumn('order_no');
- table.dropColumn('device_id');
- table.dropColumn('device_name');
- table.dropColumn('problem_desc');
- table.dropColumn('problem_type');
- table.dropColumn('feedback');
- table.dropColumn('deadline');
- });
- }
- };
- export default addWorkOrderFields;
|