From a9c1bb3013af38be28fb6100901d11ea607661cd Mon Sep 17 00:00:00 2001 From: Chris Veleris Date: Tue, 14 Apr 2026 16:02:58 +0300 Subject: [PATCH] fix: resolve column count mismatch in password-optional migration The migration was using SELECT * which caused a column count mismatch (37 columns in new table vs 33 in old table). Now explicitly lists columns to copy, allowing new AI-related columns to get default values. Fixes Docker container startup failure with SQLITE_ERROR. --- .../20260420000004-make-password-optional.js | 56 +++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/backend/migrations/20260420000004-make-password-optional.js b/backend/migrations/20260420000004-make-password-optional.js index 9b5bddf..f7bce00 100644 --- a/backend/migrations/20260420000004-make-password-optional.js +++ b/backend/migrations/20260420000004-make-password-optional.js @@ -49,8 +49,32 @@ module.exports = { `); await queryInterface.sequelize.query(` - INSERT INTO users_new - SELECT * FROM users; + INSERT INTO users_new ( + id, uid, name, surname, email, password_digest, appearance, language, + timezone, first_day_of_week, avatar_image, telegram_bot_token, + telegram_chat_id, task_summary_enabled, task_summary_frequency, + task_summary_last_run, task_summary_next_run, telegram_allowed_users, + task_intelligence_enabled, auto_suggest_next_actions_enabled, + pomodoro_enabled, productivity_assistant_enabled, + next_task_suggestion_enabled, today_settings, sidebar_settings, + ui_settings, notification_preferences, keyboard_shortcuts, + email_verified, email_verification_token, + email_verification_token_expires_at, created_at, updated_at + ) + SELECT + id, uid, name, surname, email, + COALESCE(password_digest, NULL) as password_digest, + appearance, language, + timezone, first_day_of_week, avatar_image, telegram_bot_token, + telegram_chat_id, task_summary_enabled, task_summary_frequency, + task_summary_last_run, task_summary_next_run, telegram_allowed_users, + task_intelligence_enabled, auto_suggest_next_actions_enabled, + pomodoro_enabled, productivity_assistant_enabled, + next_task_suggestion_enabled, today_settings, sidebar_settings, + ui_settings, notification_preferences, keyboard_shortcuts, + email_verified, email_verification_token, + email_verification_token_expires_at, created_at, updated_at + FROM users; `); await queryInterface.sequelize.query('DROP TABLE users;'); @@ -110,8 +134,32 @@ module.exports = { `); await queryInterface.sequelize.query(` - INSERT INTO users_new - SELECT * FROM users; + INSERT INTO users_new ( + id, uid, name, surname, email, password_digest, appearance, language, + timezone, first_day_of_week, avatar_image, telegram_bot_token, + telegram_chat_id, task_summary_enabled, task_summary_frequency, + task_summary_last_run, task_summary_next_run, telegram_allowed_users, + task_intelligence_enabled, auto_suggest_next_actions_enabled, + pomodoro_enabled, productivity_assistant_enabled, + next_task_suggestion_enabled, today_settings, sidebar_settings, + ui_settings, notification_preferences, keyboard_shortcuts, + email_verified, email_verification_token, + email_verification_token_expires_at, created_at, updated_at, + ai_provider, openai_api_key, ollama_base_url, ollama_model + ) + SELECT + id, uid, name, surname, email, password_digest, appearance, language, + timezone, first_day_of_week, avatar_image, telegram_bot_token, + telegram_chat_id, task_summary_enabled, task_summary_frequency, + task_summary_last_run, task_summary_next_run, telegram_allowed_users, + task_intelligence_enabled, auto_suggest_next_actions_enabled, + pomodoro_enabled, productivity_assistant_enabled, + next_task_suggestion_enabled, today_settings, sidebar_settings, + ui_settings, notification_preferences, keyboard_shortcuts, + email_verified, email_verification_token, + email_verification_token_expires_at, created_at, updated_at, + ai_provider, openai_api_key, ollama_base_url, ollama_model + FROM users; `); await queryInterface.sequelize.query('DROP TABLE users;');