31 lines
682 B
Python
31 lines
682 B
Python
from sqlalchemy import Table, MetaData, Index
|
|
|
|
meta = MetaData()
|
|
|
|
|
|
def _get_indices(meta):
|
|
meta.reflect()
|
|
Tasks = Table("analyze_tasks", meta, autoload=True, autoload_with=meta.bind)
|
|
return [
|
|
Index(
|
|
"tasks_second_step_idx",
|
|
Tasks.c.repository_id,
|
|
Tasks.c.status,
|
|
Tasks.c.level,
|
|
Tasks.c.improvement_absolute,
|
|
Tasks.c.improvement_relative,
|
|
)
|
|
]
|
|
|
|
|
|
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()
|