-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(PC-33423)[API] feat: migration remove unicity constraints
- Loading branch information
1 parent
65175e7
commit fda8427
Showing
3 changed files
with
83 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
f8588023c126 (pre) (head) | ||
b18478ab2ea8 (post) (head) | ||
4c53718279e7 (post) (head) |
77 changes: 77 additions & 0 deletions
77
.../alembic/versions/20241220T091708_4c53718279e7_drop_headline_offer_unicity_constraints.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
""" | ||
Drop headline offer unicity constraints on offer and venue | ||
""" | ||
|
||
from alembic import op | ||
|
||
|
||
# pre/post deployment: post | ||
# revision identifiers, used by Alembic. | ||
revision = "4c53718279e7" | ||
down_revision = "b18478ab2ea8" | ||
branch_labels: tuple[str] | None = None | ||
depends_on: list[str] | None = None | ||
|
||
|
||
def upgrade() -> None: | ||
with op.get_context().autocommit_block(): | ||
op.drop_index( | ||
"ix_headline_offer_offerId", | ||
table_name="headline_offer", | ||
postgresql_concurrently=True, | ||
if_exists=True, | ||
) | ||
op.create_index( | ||
op.f("ix_headline_offer_offerId"), | ||
"headline_offer", | ||
["offerId"], | ||
unique=False, | ||
postgresql_concurrently=True, | ||
if_not_exists=True, | ||
) | ||
op.drop_index( | ||
"ix_headline_offer_venueId", | ||
table_name="headline_offer", | ||
postgresql_concurrently=True, | ||
if_exists=True, | ||
) | ||
op.create_index( | ||
op.f("ix_headline_offer_venueId"), | ||
"headline_offer", | ||
["venueId"], | ||
unique=False, | ||
postgresql_concurrently=True, | ||
if_not_exists=True, | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
with op.get_context().autocommit_block(): | ||
op.drop_index( | ||
op.f("ix_headline_offer_venueId"), | ||
table_name="headline_offer", | ||
postgresql_concurrently=True, | ||
if_exists=True, | ||
) | ||
op.create_index( | ||
"ix_headline_offer_venueId", | ||
"headline_offer", | ||
["venueId"], | ||
unique=True, | ||
postgresql_concurrently=True, | ||
if_not_exists=True, | ||
) | ||
op.drop_index( | ||
op.f("ix_headline_offer_offerId"), | ||
table_name="headline_offer", | ||
postgresql_concurrently=True, | ||
if_exists=True, | ||
) | ||
op.create_index( | ||
"ix_headline_offer_offerId", | ||
"headline_offer", | ||
["offerId"], | ||
unique=True, | ||
postgresql_concurrently=True, | ||
if_not_exists=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters