-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1654 from jadmsaadaot/TRACK-task#1331-B
Add None ministry row
- Loading branch information
Showing
2 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
epictrack-api/migrations/versions/09a79ca8e8fd_add_none_ministry.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,49 @@ | ||
"""Add None ministry in ministries table | ||
Revision ID: 09a79ca8e8fd | ||
Revises: 65cb91595d6a | ||
Create Date: 2024-01-11 13:19:49.744798 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '09a79ca8e8fd' | ||
down_revision = '65cb91595d6a' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
NoneMinistryName = 'None' | ||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
|
||
ministries = sa.table( | ||
'ministries', | ||
sa.Column('name', sa.String), | ||
sa.column('abbreviation', sa.String), | ||
sa.Column('is_active', sa.Boolean), | ||
sa.Column('is_deleted', sa.Boolean), | ||
sa.Column('sort_order', sa.Integer), | ||
) | ||
|
||
op.execute( | ||
ministries.insert().values( | ||
name=NoneMinistryName, | ||
abbreviation=NoneMinistryName, | ||
is_active=True, | ||
is_deleted=False, | ||
sort_order=-1, | ||
) | ||
) | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
|
||
op.execute(f"delete from ministries where name='{NoneMinistryName}'") | ||
|
||
# ### 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