@@ -96,6 +96,8 @@ def run_migrations_offline(self, context: "EnvironmentContext") -> None:
9696 # for --sql use case, run migrations for each URL into
9797 # individual files.
9898
99+ conf_args = self .get_user_context_configurations ()
100+
99101 for key , engine in self .db_service .engines .items ():
100102 logger .info ("Migrating database %s" % key )
101103
@@ -104,18 +106,14 @@ def run_migrations_offline(self, context: "EnvironmentContext") -> None:
104106
105107 file_ = "%s.sql" % key
106108 logger .info ("Writing output to %s" % file_ )
109+
107110 with open (file_ , "w" ) as buffer :
108111 context .configure (
109112 url = url ,
110113 output_buffer = buffer ,
111114 target_metadata = metadata ,
112115 literal_binds = True ,
113- dialect_opts = {"paramstyle" : "named" },
114- # If you want to ignore things like these, set the following as a class attribute
115- # __table_args__ = {"info": {"skip_autogen": True}}
116- include_object = self .include_object ,
117- # detecting type changes
118- # compare_type=True,
116+ ** conf_args ,
119117 )
120118 with context .begin_transaction ():
121119 context .run_migrations (engine_name = key )
@@ -126,12 +124,11 @@ def _migration_action(
126124 # this callback is used to prevent an auto-migration from being generated
127125 # when there are no changes to the schema
128126 # reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html
129- conf_args = {
130- "process_revision_directives" : self .default_process_revision_directives
131- }
132- # conf_args = current_app.extensions['migrate'].configure_args
133- # if conf_args.get("process_revision_directives") is None:
134- # conf_args["process_revision_directives"] = process_revision_directives
127+
128+ conf_args = self .get_user_context_configurations ()
129+ conf_args .setdefault (
130+ "process_revision_directives" , self .default_process_revision_directives
131+ )
135132
136133 try :
137134 for db_info in db_infos :
0 commit comments