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.
This commit is contained in:
parent
214cb3a0c8
commit
a9c1bb3013
1 changed files with 52 additions and 4 deletions
|
|
@ -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;');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue