-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
9 changed files
with
110 additions
and
26 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
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
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
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
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
59 changes: 59 additions & 0 deletions
59
migrations/versions/d0a6fab28b7f_add_label_to_project_crew_membership.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,59 @@ | ||
"""Add label to project crew membership. | ||
Revision ID: d0a6fab28b7f | ||
Revises: 7aa9eb80aab4 | ||
Create Date: 2023-03-15 01:37:55.947574 | ||
""" | ||
|
||
from typing import Optional, Tuple, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = 'd0a6fab28b7f' | ||
down_revision: str = '7aa9eb80aab4' | ||
branch_labels: Optional[Union[str, Tuple[str, ...]]] = None | ||
depends_on: Optional[Union[str, Tuple[str, ...]]] = None | ||
|
||
|
||
def upgrade(engine_name='') -> None: | ||
"""Upgrade all databases.""" | ||
# Do not modify. Edit `upgrade_` instead | ||
globals().get(f'upgrade_{engine_name}', lambda: None)() | ||
|
||
|
||
def downgrade(engine_name='') -> None: | ||
"""Downgrade all databases.""" | ||
# Do not modify. Edit `downgrade_` instead | ||
globals().get(f'downgrade_{engine_name}', lambda: None)() | ||
|
||
|
||
def upgrade_() -> None: | ||
"""Upgrade database bind ''.""" | ||
with op.batch_alter_table('project_crew_membership', schema=None) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
'label', | ||
sa.Unicode(), | ||
sa.CheckConstraint( | ||
"label <> ''", name='project_crew_membership_label_check' | ||
), | ||
nullable=True, | ||
) | ||
) | ||
|
||
|
||
def downgrade_() -> None: | ||
"""Downgrade database bind ''.""" | ||
with op.batch_alter_table('project_crew_membership', schema=None) as batch_op: | ||
batch_op.drop_column('label') | ||
|
||
|
||
def upgrade_geoname() -> None: | ||
"""Upgrade database bind 'geoname'.""" | ||
|
||
|
||
def downgrade_geoname() -> None: | ||
"""Downgrade database bind 'geoname'.""" |