Skip to content

Commit 74c0dec

Browse files
committed
Fix downgrade migration
1 parent 255da4b commit 74c0dec

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

syncmaster/db/migrations/versions/2023-11-23_0007_create_transfer_table.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020

2121
def upgrade():
2222
sql_expression = (
23-
"to_tsvector('english'::regconfig, "
24-
"name || ' ' || "
23+
"to_tsvector('english'::regconfig, name || ' ' || "
2524
"COALESCE(json_extract_path_text(source_params, 'table_name'), '') || ' ' || "
2625
"COALESCE(json_extract_path_text(target_params, 'table_name'), '') || ' ' || "
2726
"COALESCE(json_extract_path_text(source_params, 'directory_path'), '') || ' ' || "
@@ -30,8 +29,7 @@ def upgrade():
3029
"COALESCE(translate(json_extract_path_text(source_params, 'table_name'), './', ' '), '') || ' ' || "
3130
"COALESCE(translate(json_extract_path_text(target_params, 'table_name'), './', ' '), '') || ' ' || "
3231
"COALESCE(translate(json_extract_path_text(source_params, 'directory_path'), './', ' '), '') || ' ' || "
33-
"COALESCE(translate(json_extract_path_text(target_params, 'directory_path'), './', ' '), '')"
34-
")"
32+
"COALESCE(translate(json_extract_path_text(target_params, 'directory_path'), './', ' '), ''))"
3533
)
3634
op.create_table(
3735
"transfer",

syncmaster/db/migrations/versions/2025-08-10_0012_update_ts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def downgrade() -> None:
201201
"search_vector",
202202
postgresql.TSVECTOR(),
203203
sa.Computed(
204-
"to_tsvector('english'::regconfig, name || ' ') || "
204+
"to_tsvector('english'::regconfig, name || ' ' || "
205205
"COALESCE(json_extract_path_text(source_params, VARIADIC ARRAY['table_name']), '') || ' ' || "
206206
"COALESCE(json_extract_path_text(target_params, VARIADIC ARRAY['table_name']), '') || ' ' || "
207207
"COALESCE(json_extract_path_text(source_params, VARIADIC ARRAY['directory_path']), '') || ' ' || "
@@ -210,7 +210,7 @@ def downgrade() -> None:
210210
"COALESCE(translate(json_extract_path_text(source_params, VARIADIC ARRAY['table_name']), './', ' '), '') || ' ' || "
211211
"COALESCE(translate(json_extract_path_text(target_params, VARIADIC ARRAY['table_name']), './', ' '), '') || ' ' || "
212212
"COALESCE(translate(json_extract_path_text(source_params, VARIADIC ARRAY['directory_path']), './', ' '), '') || ' ' || "
213-
"COALESCE(translate(json_extract_path_text(target_params, VARIADIC ARRAY['directory_path']), './', ' '), '')",
213+
"COALESCE(translate(json_extract_path_text(target_params, VARIADIC ARRAY['directory_path']), './', ' '), ''))",
214214
persisted=True,
215215
),
216216
autoincrement=False,

0 commit comments

Comments
 (0)