Skip to content

Commit 7526a43

Browse files
♻️ licensed_items migration add product to key, version unique index key (🗃️) (#7260)
1 parent 870b9b2 commit 7526a43

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"""idx licensed items - key/version/product
2+
3+
Revision ID: a8d336ca9379
4+
Revises: 5e43b5ec7604
5+
Create Date: 2025-02-21 14:29:42.575724+00:00
6+
7+
"""
8+
from alembic import op
9+
10+
# revision identifiers, used by Alembic.
11+
revision = "a8d336ca9379"
12+
down_revision = "5e43b5ec7604"
13+
branch_labels = None
14+
depends_on = None
15+
16+
17+
def upgrade():
18+
# ### commands auto generated by Alembic - please adjust! ###
19+
op.drop_index("idx_licensed_items_key_version", table_name="licensed_items")
20+
op.create_index(
21+
"idx_licensed_items_key_version_product",
22+
"licensed_items",
23+
["key", "version", "product_name"],
24+
unique=True,
25+
)
26+
# ### end Alembic commands ###
27+
28+
29+
def downgrade():
30+
# ### commands auto generated by Alembic - please adjust! ###
31+
op.drop_index("idx_licensed_items_key_version_product", table_name="licensed_items")
32+
op.create_index(
33+
"idx_licensed_items_key_version",
34+
"licensed_items",
35+
["key", "version"],
36+
unique=True,
37+
)
38+
# ### end Alembic commands ###

packages/postgres-database/src/simcore_postgres_database/models/licensed_items.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,11 @@ class LicensedResourceType(str, enum.Enum):
7878
),
7979
column_created_datetime(timezone=True),
8080
column_modified_datetime(timezone=True),
81-
sa.Index("idx_licensed_items_key_version", "key", "version", unique=True),
81+
sa.Index(
82+
"idx_licensed_items_key_version_product",
83+
"key",
84+
"version",
85+
"product_name",
86+
unique=True,
87+
),
8288
)

0 commit comments

Comments
 (0)