From 6c40d352c9946a017eee7b7f6fb3731f8a8e6117 Mon Sep 17 00:00:00 2001 From: Sam Chau Date: Sun, 24 Aug 2025 16:07:38 +0930 Subject: [PATCH] fix(migration): update default language score --- .gitignore | 1 + .../004_update_language_score_default.py | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 backend/app/db/migrations/versions/004_update_language_score_default.py diff --git a/.gitignore b/.gitignore index 36a2a68..d6171fe 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ backend/app/static/ # Config data config/ +config-test/ radarr-config/ sonarr-config/ test-data/ \ No newline at end of file diff --git a/backend/app/db/migrations/versions/004_update_language_score_default.py b/backend/app/db/migrations/versions/004_update_language_score_default.py new file mode 100644 index 0000000..c010870 --- /dev/null +++ b/backend/app/db/migrations/versions/004_update_language_score_default.py @@ -0,0 +1,33 @@ +# backend/app/db/migrations/versions/004_update_language_score_default.py +from ...connection import get_db + +version = 4 +name = "update_language_score_default" + + +def up(): + """Update default language import score to -999999.""" + with get_db() as conn: + # Update existing record to new default value + conn.execute(''' + UPDATE language_import_config + SET score = -999999, + updated_at = CURRENT_TIMESTAMP + WHERE id = 1 + ''') + + conn.commit() + + +def down(): + """Revert language import score to previous default.""" + with get_db() as conn: + # Revert to previous default value + conn.execute(''' + UPDATE language_import_config + SET score = -99999, + updated_at = CURRENT_TIMESTAMP + WHERE id = 1 + ''') + + conn.commit() \ No newline at end of file