-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛(api) make the
PointDeCharge.id_pdc_itinerance
field unique
My bad. Dunno how I could have missed this?
- Loading branch information
Showing
3 changed files
with
47 additions
and
1 deletion.
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
43 changes: 43 additions & 0 deletions
43
src/api/qualicharge/migrations/versions/d1e96368f232_id_pdc_itinerance_should_be_unique.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,43 @@ | ||
"""id_pdc_itinerance should be unique | ||
Revision ID: d1e96368f232 | ||
Revises: f5416bc7dd5f | ||
Create Date: 2024-07-31 15:25:26.997834 | ||
""" | ||
|
||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "d1e96368f232" | ||
down_revision: Union[str, None] = "f5416bc7dd5f" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index("ix_pointdecharge_id_pdc_itinerance", table_name="pointdecharge") | ||
op.create_index( | ||
op.f("ix_pointdecharge_id_pdc_itinerance"), | ||
"pointdecharge", | ||
["id_pdc_itinerance"], | ||
unique=True, | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index( | ||
op.f("ix_pointdecharge_id_pdc_itinerance"), table_name="pointdecharge" | ||
) | ||
op.create_index( | ||
"ix_pointdecharge_id_pdc_itinerance", | ||
"pointdecharge", | ||
["id_pdc_itinerance"], | ||
unique=False, | ||
) | ||
# ### end Alembic commands ### |
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