Skip to content

Commit

Permalink
upgrade postgres package - shortuuid
Browse files Browse the repository at this point in the history
  • Loading branch information
matusdrobuliak66 committed Dec 3, 2024
1 parent 6f9c844 commit c296b0d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""add license db tables
Revision ID: dd0d2a5a993b
Revision ID: 707fe8c2e7f5
Revises: e05bdc5b3c7b
Create Date: 2024-12-03 14:55:22.308786+00:00
Create Date: 2024-12-03 15:32:02.797511+00:00
"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "dd0d2a5a993b"
revision = "707fe8c2e7f5"
down_revision = "e05bdc5b3c7b"
branch_labels = None
depends_on = None
Expand Down Expand Up @@ -52,8 +52,8 @@ def upgrade():
)
op.create_table(
"resource_tracker_license_checkouts",
sa.Column("license_checkout_id", sa.BigInteger(), nullable=False),
sa.Column("license_package_id", sa.BigInteger(), nullable=True),
sa.Column("license_checkout_id", sa.String(), nullable=False),
sa.Column("license_package_id", sa.String(), nullable=True),
sa.Column("wallet_id", sa.BigInteger(), nullable=False),
sa.Column("user_id", sa.BigInteger(), nullable=False),
sa.Column("user_email", sa.String(), nullable=True),
Expand All @@ -69,9 +69,12 @@ def upgrade():
nullable=False,
),
sa.ForeignKeyConstraint(
["service_run_id"],
["resource_tracker_service_runs.service_run_id"],
name="fk_resource_tracker_license_checkouts_service_run_id",
["product_name", "service_run_id"],
[
"resource_tracker_service_runs.product_name",
"resource_tracker_service_runs.service_run_id",
],
name="resource_tracker_license_checkouts_service_run_id_fkey",
onupdate="CASCADE",
ondelete="RESTRICT",
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ def _custom_id_generator():
metadata,
sa.Column(
"license_checkout_id",
sa.BigInteger,
sa.String,
nullable=False,
primary_key=True,
default=_custom_id_generator,
),
sa.Column(
"license_package_id",
sa.BigInteger,
sa.String,
nullable=True,
),
sa.Column(
Expand All @@ -47,12 +47,6 @@ def _custom_id_generator():
sa.Column(
"service_run_id",
sa.String,
sa.ForeignKey(
"resource_tracker_service_runs.service_run_id",
name="fk_resource_tracker_license_checkouts_service_run_id",
onupdate=RefActions.CASCADE,
ondelete=RefActions.RESTRICT,
),
nullable=True,
),
sa.Column(
Expand All @@ -73,6 +67,17 @@ def _custom_id_generator():
nullable=False,
),
column_modified_datetime(timezone=True),
# ---------------------------
sa.ForeignKeyConstraint(
["product_name", "service_run_id"],
[
"resource_tracker_service_runs.product_name",
"resource_tracker_service_runs.service_run_id",
],
name="resource_tracker_license_checkouts_service_run_id_fkey",
onupdate=RefActions.CASCADE,
ondelete=RefActions.RESTRICT,
),
)

# We define the partial index
Expand Down

0 comments on commit c296b0d

Please sign in to comment.