File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 36
36
config .set_main_option ('sqlalchemy.url' , SQLALCHEMY_DATABASE_URL )
37
37
38
38
39
+ def include_name (name , type_ , parent_names ):
40
+ if type_ == "table" :
41
+ return name in target_metadata .tables
42
+ else :
43
+ return True
44
+
45
+
39
46
def run_migrations_offline ():
40
47
"""Run migrations in 'offline' mode.
41
48
@@ -54,14 +61,19 @@ def run_migrations_offline():
54
61
target_metadata = target_metadata ,
55
62
literal_binds = True ,
56
63
dialect_opts = {'paramstyle' : 'named' },
64
+ include_name = include_name ,
57
65
)
58
66
59
67
with context .begin_transaction ():
60
68
context .run_migrations ()
61
69
62
70
63
71
def do_run_migrations (connection ):
64
- context .configure (connection = connection , target_metadata = target_metadata )
72
+ context .configure (
73
+ connection = connection ,
74
+ target_metadata = target_metadata ,
75
+ include_name = include_name ,
76
+ )
65
77
66
78
with context .begin_transaction ():
67
79
context .run_migrations ()
You can’t perform that action at this time.
0 commit comments