From c9796f7d67959b9c6a75353a6bc3168c30b6de89 Mon Sep 17 00:00:00 2001 From: K Agajanian Date: Fri, 6 Sep 2024 12:22:20 -0400 Subject: [PATCH] woop --- alembic.ini | 2 +- migrations/env.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/alembic.ini b/alembic.ini index 58f98ec..d8a0020 100644 --- a/alembic.ini +++ b/alembic.ini @@ -8,7 +8,7 @@ script_location = ./migrations # Uncomment the line below if you want the files to be prepended with date and time # see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file # for all available tokens -file_template = %%(year)d_%%(month).2d_%%(day).2d-%%(rev)s +file_template = %%(slug)s # sys.path path, will be prepended to sys.path if present. # defaults to the current working directory. diff --git a/migrations/env.py b/migrations/env.py index 30834d5..498cd9d 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -98,6 +98,9 @@ def run_migrations_online() -> None: target_metadata=target_metadata, process_revision_directives=process_revision_directives, # Make sure geoalchemy import included with any autogen script include_object=include_object, + dialect_opts={"paramstyle": "named"}, + include_schemas=True, + include_name=include_name, ) for schema in SCHEMATA: @@ -110,6 +113,13 @@ def run_migrations_online() -> None: context.run_migrations() +def include_name(name, type_, parent_names): + if type_ == "schema": + return name in SCHEMATA + else: + return True + + if context.is_offline_mode(): run_migrations_offline() else: