fix: audit findings — list details, batch integrity, migrations, restore fidelity
ci / docker (push) Successful in 3m17s
ci / docker (push) Successful in 3m17s
This commit is contained in:
@@ -3,6 +3,7 @@ Revision ID: 0006
|
||||
Revises: 0005
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision = "0006"
|
||||
@@ -12,12 +13,18 @@ depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.drop_index("ix_habit_logs_habit_day", table_name="habit_logs")
|
||||
bind = op.get_bind()
|
||||
indexes = {index["name"] for index in sa.inspect(bind).get_indexes("habit_logs")}
|
||||
if "ix_habit_logs_habit_day" in indexes:
|
||||
op.drop_index("ix_habit_logs_habit_day", table_name="habit_logs")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.create_index(
|
||||
"ix_habit_logs_habit_day",
|
||||
"habit_logs",
|
||||
["habit_id", "day"],
|
||||
)
|
||||
bind = op.get_bind()
|
||||
indexes = {index["name"] for index in sa.inspect(bind).get_indexes("habit_logs")}
|
||||
if "ix_habit_logs_habit_day" not in indexes:
|
||||
op.create_index(
|
||||
"ix_habit_logs_habit_day",
|
||||
"habit_logs",
|
||||
["habit_id", "day"],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user