Remove database migrations after direct schema fixes
Changes: - Removed all migration code from server.js - Database schema fixed directly via MySQL: * Dropped users.role column (SSO only) * Dropped users.password column (SSO only) * Added executions.started_by column * Added workflows.created_by column * All tables now match expected schema - Server startup will be faster without migrations Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
34
server.js
34
server.js
@@ -46,24 +46,7 @@ async function initDatabase() {
|
||||
)
|
||||
`);
|
||||
|
||||
// Migrate existing users table to add missing columns and remove password column
|
||||
try {
|
||||
await connection.query(`ALTER TABLE users DROP COLUMN password`);
|
||||
console.log('Removed password column (using SSO authentication)');
|
||||
} catch (e) { /* Column doesn't exist */ }
|
||||
try {
|
||||
await connection.query(`ALTER TABLE users ADD COLUMN display_name VARCHAR(255) AFTER username`);
|
||||
} catch (e) { /* Column exists */ }
|
||||
try {
|
||||
await connection.query(`ALTER TABLE users ADD COLUMN email VARCHAR(255) AFTER display_name`);
|
||||
} catch (e) { /* Column exists */ }
|
||||
try {
|
||||
await connection.query(`ALTER TABLE users ADD COLUMN groups TEXT AFTER email`);
|
||||
} catch (e) { /* Column exists */ }
|
||||
try {
|
||||
await connection.query(`ALTER TABLE users ADD COLUMN last_login TIMESTAMP NULL AFTER groups`);
|
||||
} catch (e) { /* Column exists */ }
|
||||
console.log('Users table migration completed');
|
||||
// Database schema is managed manually - migrations removed after direct database fixes
|
||||
|
||||
await connection.query(`
|
||||
CREATE TABLE IF NOT EXISTS workers (
|
||||
@@ -106,21 +89,6 @@ async function initDatabase() {
|
||||
)
|
||||
`);
|
||||
|
||||
// Migrate existing executions table to allow NULL workflow_id
|
||||
try {
|
||||
await connection.query(`
|
||||
ALTER TABLE executions
|
||||
MODIFY workflow_id VARCHAR(36) NULL,
|
||||
DROP FOREIGN KEY executions_ibfk_1
|
||||
`);
|
||||
console.log('Executions table migrated to allow NULL workflow_id');
|
||||
} catch (error) {
|
||||
// Ignore error if foreign key doesn't exist or already modified
|
||||
if (!error.message.includes('check that column/key exists')) {
|
||||
console.log('Migration note:', error.message);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Database tables initialized successfully');
|
||||
} catch (error) {
|
||||
console.error('Database initialization error:', error);
|
||||
|
||||
Reference in New Issue
Block a user