style(db): ruff format the re-runnable index migrations

This commit is contained in:
2026-10-02 23:43:21 +02:00
parent dfd43ae89c
commit 90e0baa870
2 changed files with 22 additions and 14 deletions
@@ -33,13 +33,17 @@ depends_on: str | None = None
def _valid(name: str) -> bool | None: def _valid(name: str) -> bool | None:
"""The index's `indisvalid`, or None when there is no index of that name.""" """The index's `indisvalid`, or None when there is no index of that name."""
row = op.get_bind().execute( row = (
text( op.get_bind()
"SELECT i.indisvalid FROM pg_index i JOIN pg_class c ON c.oid = i.indexrelid " .execute(
"WHERE c.relname = :name" text(
), "SELECT i.indisvalid FROM pg_index i JOIN pg_class c ON c.oid = i.indexrelid "
{"name": name}, "WHERE c.relname = :name"
).first() ),
{"name": name},
)
.first()
)
return None if row is None else bool(row[0]) return None if row is None else bool(row[0])
@@ -50,13 +50,17 @@ INDEXES = {
def _valid(name: str) -> bool | None: def _valid(name: str) -> bool | None:
"""The index's `indisvalid`, or None when there is no index of that name.""" """The index's `indisvalid`, or None when there is no index of that name."""
row = op.get_bind().execute( row = (
text( op.get_bind()
"SELECT i.indisvalid FROM pg_index i JOIN pg_class c ON c.oid = i.indexrelid " .execute(
"WHERE c.relname = :name" text(
), "SELECT i.indisvalid FROM pg_index i JOIN pg_class c ON c.oid = i.indexrelid "
{"name": name}, "WHERE c.relname = :name"
).first() ),
{"name": name},
)
.first()
)
return None if row is None else bool(row[0]) return None if row is None else bool(row[0])