Skip to content

Commit

Permalink
(PC-30509)[BO] feat: validate constraint cancellation_user_fk for boo…
Browse files Browse the repository at this point in the history
…king and collective booking
  • Loading branch information
borisLeBonPro authored and Meewan committed Aug 22, 2024
1 parent 055999b commit 9d9eb33
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/alembic_version_conflict_detection.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
d3e56f793b31 (pre) (head)
84359b3cc978 (post) (head)
257bb3c980a7 (post) (head)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
add cancellationUser to collective booking foreignkey
add cancellationUser to booking foreignkey
"""

from alembic import op
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
validate constraint booking_cancellation_user_fk
"""

from alembic import op

from pcapi import settings


# pre/post deployment: post
# revision identifiers, used by Alembic.
revision = "e068f2c51128"
down_revision = "84359b3cc978"
branch_labels: tuple[str] | None = None
depends_on: list[str] | None = None


def upgrade() -> None:
op.execute("SET SESSION statement_timeout='300s'") # or more if needed
op.execute("""ALTER TABLE booking VALIDATE CONSTRAINT "booking_cancellation_user_fk" """)
op.execute(f"SET SESSION statement_timeout={settings.DATABASE_STATEMENT_TIMEOUT}")


def downgrade() -> None:
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
validate constraint collective booking_cancellation_user_fk
"""

from alembic import op

from pcapi import settings


# pre/post deployment: post
# revision identifiers, used by Alembic.
revision = "257bb3c980a7"
down_revision = "e068f2c51128"
branch_labels: tuple[str] | None = None
depends_on: list[str] | None = None


def upgrade() -> None:
op.execute("SET SESSION statement_timeout='300s'") # or more if needed
op.execute("""ALTER TABLE collective_booking VALIDATE CONSTRAINT "collective_booking_cancellation_user_fk" """)
op.execute(f"SET SESSION statement_timeout={settings.DATABASE_STATEMENT_TIMEOUT}")


def downgrade() -> None:
pass

0 comments on commit 9d9eb33

Please sign in to comment.