设备总包项目管理剩余页面
This commit is contained in:
47
fad-rolling-mill/migration_layer1.js
Normal file
47
fad-rolling-mill/migration_layer1.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const mysql = require('mysql2/promise');
|
||||
|
||||
async function run() {
|
||||
const conn = await mysql.createConnection({
|
||||
host: '49.232.154.205',
|
||||
port: 13306,
|
||||
user: 'root',
|
||||
password: 'Root@12345',
|
||||
database: 'fad_oa_dev'
|
||||
});
|
||||
|
||||
console.log('Connected. Running migration...\n');
|
||||
|
||||
// 1. Add manager_id to fad_rm_project
|
||||
await conn.execute(`
|
||||
ALTER TABLE fad_rm_project
|
||||
ADD COLUMN manager_id BIGINT DEFAULT NULL COMMENT '项目经理用户ID,关联sys_user.user_id'
|
||||
AFTER manager
|
||||
`);
|
||||
console.log('✓ Added manager_id to fad_rm_project');
|
||||
|
||||
// 2. Create fad_rm_project_member table
|
||||
await conn.execute(`
|
||||
CREATE TABLE IF NOT EXISTS fad_rm_project_member (
|
||||
member_id BIGINT NOT NULL AUTO_INCREMENT COMMENT '成员ID',
|
||||
project_id BIGINT NOT NULL COMMENT '项目ID',
|
||||
user_id BIGINT NOT NULL COMMENT '用户ID',
|
||||
role VARCHAR(50) DEFAULT 'member' COMMENT '角色: manager/member/viewer',
|
||||
create_by VARCHAR(64) DEFAULT '' COMMENT '创建者',
|
||||
create_time DATETIME DEFAULT NULL COMMENT '创建时间',
|
||||
update_by VARCHAR(64) DEFAULT '' COMMENT '更新者',
|
||||
update_time DATETIME DEFAULT NULL COMMENT '更新时间',
|
||||
del_flag INT DEFAULT 0 COMMENT '删除标志',
|
||||
PRIMARY KEY (member_id),
|
||||
UNIQUE KEY uk_project_user (project_id, user_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='项目成员表'
|
||||
`);
|
||||
console.log('✓ Created fad_rm_project_member table');
|
||||
|
||||
await conn.end();
|
||||
console.log('\nMigration complete!');
|
||||
}
|
||||
|
||||
run().catch(err => {
|
||||
console.error('Migration failed:', err.message);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user