From 6d15e4d240f1e45f068ef24938dbd9255dcb3afe Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Wed, 7 Jan 2026 22:11:07 -0500 Subject: [PATCH] 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 --- .gitignore | 3 +++ server.js | 34 +--------------------------------- 2 files changed, 4 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index 5d3c1f8..4d5b28f 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,6 @@ Thumbs.db *.swp *.swo *~ + +# Claude +Claude.md \ No newline at end of file diff --git a/server.js b/server.js index 14d7f02..f247418 100644 --- a/server.js +++ b/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);