@@ -168,34 +168,32 @@ def get_schema_options() -> (
168
168
)
169
169
170
170
# Specific schema names filtering (replaces both schema_name and the old tenant_ids approach)
171
- specific_schema_names = None
172
- if "specific_schema_names " in x_args :
173
- schema_names_str = x_args ["specific_schema_names " ].strip ()
171
+ schemas = None
172
+ if "schemas " in x_args :
173
+ schema_names_str = x_args ["schemas " ].strip ()
174
174
if schema_names_str :
175
175
# Split by comma and strip whitespace
176
- specific_schema_names = [
176
+ schemas = [
177
177
name .strip () for name in schema_names_str .split ("," ) if name .strip ()
178
178
]
179
- if specific_schema_names :
180
- logger .info (f"Specific schema names specified: { specific_schema_names } " )
179
+ if schemas :
180
+ logger .info (f"Specific schema names specified: { schemas } " )
181
181
182
182
# Validate that only one method is used at a time
183
183
range_filtering = tenant_range_start is not None or tenant_range_end is not None
184
- specific_filtering = (
185
- specific_schema_names is not None and len (specific_schema_names ) > 0
186
- )
184
+ specific_filtering = schemas is not None and len (schemas ) > 0
187
185
188
186
if range_filtering and specific_filtering :
189
187
raise ValueError (
190
188
"Cannot use both tenant range filtering (tenant_range_start/tenant_range_end) "
191
- "and specific schema filtering (specific_schema_names ) at the same time. "
189
+ "and specific schema filtering (schemas ) at the same time. "
192
190
"Please use only one filtering method."
193
191
)
194
192
195
193
if upgrade_all_tenants and specific_filtering :
196
194
raise ValueError (
197
- "Cannot use both upgrade_all_tenants=true and specific_schema_names at the same time. "
198
- "Use either upgrade_all_tenants=true for all tenants, or specific_schema_names for specific schemas."
195
+ "Cannot use both upgrade_all_tenants=true and schemas at the same time. "
196
+ "Use either upgrade_all_tenants=true for all tenants, or schemas for specific schemas."
199
197
)
200
198
201
199
# If any filtering parameters are specified, we're not doing the default single schema migration
@@ -206,7 +204,7 @@ def get_schema_options() -> (
206
204
if MULTI_TENANT and not upgrade_all_tenants and not specific_filtering :
207
205
raise ValueError (
208
206
"In multi-tenant mode, you must specify either upgrade_all_tenants=true "
209
- "or provide specific_schema_names . Cannot run default migration."
207
+ "or provide schemas . Cannot run default migration."
210
208
)
211
209
212
210
return (
@@ -215,7 +213,7 @@ def get_schema_options() -> (
215
213
continue_on_error ,
216
214
tenant_range_start ,
217
215
tenant_range_end ,
218
- specific_schema_names ,
216
+ schemas ,
219
217
)
220
218
221
219
@@ -268,7 +266,7 @@ async def run_async_migrations() -> None:
268
266
continue_on_error ,
269
267
tenant_range_start ,
270
268
tenant_range_end ,
271
- specific_schema_names ,
269
+ schemas ,
272
270
) = get_schema_options ()
273
271
274
272
# without init_engine, subsequent engine calls fail hard intentionally
@@ -287,13 +285,13 @@ def event_provide_iam_token_for_alembic(
287
285
) -> None :
288
286
provide_iam_token_for_alembic (dialect , conn_rec , cargs , cparams )
289
287
290
- if specific_schema_names :
288
+ if schemas :
291
289
# Use specific schema names directly without fetching all tenants
292
- logger .info (f"Migrating specific schema names: { specific_schema_names } " )
290
+ logger .info (f"Migrating specific schema names: { schemas } " )
293
291
294
292
i_schema = 0
295
- num_schemas = len (specific_schema_names )
296
- for schema in specific_schema_names :
293
+ num_schemas = len (schemas )
294
+ for schema in schemas :
297
295
i_schema += 1
298
296
logger .info (
299
297
f"Migrating schema: index={ i_schema } num_schemas={ num_schemas } schema={ schema } "
@@ -352,11 +350,11 @@ def event_provide_iam_token_for_alembic(
352
350
353
351
else :
354
352
# This should not happen in the new design since we require either
355
- # upgrade_all_tenants=true or specific_schema_names in multi-tenant mode
356
- # and for non-multi-tenant mode, we should use specific_schema_names with the default schema
353
+ # upgrade_all_tenants=true or schemas in multi-tenant mode
354
+ # and for non-multi-tenant mode, we should use schemas with the default schema
357
355
raise ValueError (
358
356
"No migration target specified. Use either upgrade_all_tenants=true for all tenants "
359
- "or specific_schema_names for specific schemas."
357
+ "or schemas for specific schemas."
360
358
)
361
359
362
360
await engine .dispose ()
@@ -384,15 +382,15 @@ def run_migrations_offline() -> None:
384
382
continue_on_error ,
385
383
tenant_range_start ,
386
384
tenant_range_end ,
387
- specific_schema_names ,
385
+ schemas ,
388
386
) = get_schema_options ()
389
387
url = build_connection_string ()
390
388
391
- if specific_schema_names :
389
+ if schemas :
392
390
# Use specific schema names directly without fetching all tenants
393
- logger .info (f"Migrating specific schema names: { specific_schema_names } " )
391
+ logger .info (f"Migrating specific schema names: { schemas } " )
394
392
395
- for schema in specific_schema_names :
393
+ for schema in schemas :
396
394
logger .info (f"Migrating schema: { schema } " )
397
395
context .configure (
398
396
url = url ,
@@ -453,7 +451,7 @@ def event_provide_iam_token_for_alembic_offline(
453
451
# This should not happen in the new design
454
452
raise ValueError (
455
453
"No migration target specified. Use either upgrade_all_tenants=true for all tenants "
456
- "or specific_schema_names for specific schemas."
454
+ "or schemas for specific schemas."
457
455
)
458
456
459
457
0 commit comments