Skip to content

Commit

Permalink
lint/fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
nick8325 committed Feb 5, 2024
1 parent 036fff2 commit 9b6a703
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion karp-backend/src/karp/lex_infrastructure/sql/sql_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def get_or_create_entry_runtime_model( # noqa: D103, C901

attributes = {
"__tablename__": table_name,
"__table_args__": (foreign_key_constraint,) + BaseRuntimeEntry.__table_args__,
"__table_args__": (foreign_key_constraint, *BaseRuntimeEntry.__table_args__)
}
child_tables = {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,25 @@
Create Date: 2024-02-05 11:29:56.613345
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '44229cf4d74b'
down_revision = 'e09588a7e6ca'
revision = "44229cf4d74b"
down_revision = "e09588a7e6ca"
branch_labels = None
depends_on = None


def upgrade():
conn = op.get_bind()
for resource_id, table_name in conn.execute(
sa.text("select distinct resource_id, table_name from resources")
for (table_name,) in conn.execute(
sa.text("select distinct table_name from resources")
):
op.execute(f"alter table {table_name} drop constraint if exists id_version_unique_constraint")
op.execute(
f"alter table {table_name} drop constraint if exists id_version_unique_constraint"
)
op.create_unique_constraint(
"id_version_unique_constraint",
table_name,
["entity_id", "version"])
"id_version_unique_constraint", table_name, ["entity_id", "version"]
)

0 comments on commit 9b6a703

Please sign in to comment.