1
+ #!/usr/bin/env python3
1
2
# -*- coding: utf-8 -*-
3
+ # ruff: noqa: E402
2
4
import asyncio
3
5
import os
4
6
from logging .config import fileConfig
24
26
25
27
# add your model's MetaData object here
26
28
# for 'autogenerate' support
27
- from common .msd .model import MappedBase # noqa: E402
29
+ # https://alembic.sqlalchemy.org/en/latest/autogenerate.html#autogenerating-multiple-metadata-collections
30
+ from app .admin .model import MappedBase as AdminModel
28
31
29
- target_metadata = MappedBase .metadata
32
+ target_metadata = [
33
+ AdminModel .metadata ,
34
+ ]
30
35
31
36
# other values from the config, defined by the needs of env.py,
32
- from database .db_mysql import SQLALCHEMY_DATABASE_URL # noqa: E402
37
+ from database .db_mysql import SQLALCHEMY_DATABASE_URL
33
38
34
39
config .set_main_option ('sqlalchemy.url' , SQLALCHEMY_DATABASE_URL )
35
40
@@ -49,7 +54,7 @@ def run_migrations_offline():
49
54
url = config .get_main_option ('sqlalchemy.url' )
50
55
context .configure (
51
56
url = url ,
52
- target_metadata = target_metadata ,
57
+ target_metadata = target_metadata , # type: ignore
53
58
literal_binds = True ,
54
59
dialect_opts = {'paramstyle' : 'named' },
55
60
)
@@ -59,7 +64,7 @@ def run_migrations_offline():
59
64
60
65
61
66
def do_run_migrations (connection ):
62
- context .configure (connection = connection , target_metadata = target_metadata )
67
+ context .configure (connection = connection , target_metadata = target_metadata ) # type: ignore
63
68
64
69
with context .begin_transaction ():
65
70
context .run_migrations ()
0 commit comments