-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(api): add parent_id to tasks unique constraint (#122)
Closes #118
- Loading branch information
Showing
3 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
nesis/api/alembic/versions/cbad6afbe13d_add_parent_id_to_task_unique_constraint.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,35 @@ | ||
"""add parent_id to task unique constraint | ||
Revision ID: cbad6afbe13d | ||
Revises: 50bebf15de30 | ||
Create Date: 2024-06-13 23:59:45.211996 | ||
""" | ||
|
||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "cbad6afbe13d" | ||
down_revision: Union[str, None] = "50bebf15de30" | ||
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_constraint("uq_task_type_schedule", "task", type_="unique") | ||
op.create_unique_constraint( | ||
"uq_task_parent_id_type_schedule", "task", ["parent_id", "type", "schedule"] | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint("uq_task_parent_id_type_schedule", "task", type_="unique") | ||
op.create_unique_constraint("uq_task_type_schedule", "task", ["type", "schedule"]) | ||
# ### 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
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