Skip to content

Commit

Permalink
♻️ licensed_items migration add product to key, version unique inde…
Browse files Browse the repository at this point in the history
…x key (🗃️) (#7260)
  • Loading branch information
matusdrobuliak66 authored Feb 21, 2025
1 parent 870b9b2 commit 7526a43
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""idx licensed items - key/version/product
Revision ID: a8d336ca9379
Revises: 5e43b5ec7604
Create Date: 2025-02-21 14:29:42.575724+00:00
"""
from alembic import op

# revision identifiers, used by Alembic.
revision = "a8d336ca9379"
down_revision = "5e43b5ec7604"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index("idx_licensed_items_key_version", table_name="licensed_items")
op.create_index(
"idx_licensed_items_key_version_product",
"licensed_items",
["key", "version", "product_name"],
unique=True,
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index("idx_licensed_items_key_version_product", table_name="licensed_items")
op.create_index(
"idx_licensed_items_key_version",
"licensed_items",
["key", "version"],
unique=True,
)
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,11 @@ class LicensedResourceType(str, enum.Enum):
),
column_created_datetime(timezone=True),
column_modified_datetime(timezone=True),
sa.Index("idx_licensed_items_key_version", "key", "version", unique=True),
sa.Index(
"idx_licensed_items_key_version_product",
"key",
"version",
"product_name",
unique=True,
),
)

0 comments on commit 7526a43

Please sign in to comment.