feat: draft version

This commit is contained in:
2021-01-03 15:10:47 +03:00
parent f003ed21cd
commit 884bc0aa97
19 changed files with 494 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
from sqlalchemy import Table, MetaData, Index
meta = MetaData()
def _get_indices(meta):
meta.reflect()
Users = Table("users", meta, autoload=True, autoload_with=meta.bind)
Repositories = Table("users", meta, autoload=True, autoload_with=meta.bind)
return [
Index("repositories_name_unique_id", Users.c.id, Repositories.c.name, unique=True)
]
def upgrade(migrate_engine):
meta.bind = migrate_engine
for idx in _get_indices(meta):
idx.create()
def downgrade(migrate_engine):
meta.bind = migrate_engine
for idx in _get_indices(meta):
idx.drop()