Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ licensed_items migration add product to key, version unique index key (🗃️) #7260

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
),
)
Loading