-
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.
* work modal WIP * work modal updates * merging dev in * added migration * removed print statement * truncate tables before changing --------- Co-authored-by: Tom Chapman <tchapman000@gmail.com>
- Loading branch information
1 parent
048007b
commit 9ea4c28
Showing
11 changed files
with
11,324 additions
and
5,434 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
epictrack-api/migrations/versions/2257493941e7_rename_work_columns.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,50 @@ | ||
"""rename work columns | ||
Revision ID: 2257493941e7 | ||
Revises: 7deec389ae56 | ||
Create Date: 2023-10-23 16:12:30.470016 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '2257493941e7' | ||
down_revision = '7deec389ae56' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.execute("TRUNCATE works CASCADE") | ||
op.execute("TRUNCATE works_history CASCADE") | ||
with op.batch_alter_table('works', schema=None) as batch_op: | ||
batch_op.alter_column('short_description', new_column_name='report_description') | ||
batch_op.alter_column('long_description', new_column_name='epic_description') | ||
batch_op.alter_column('is_watched', new_column_name='is_high_priority') | ||
batch_op.drop_column('is_pecp_required') | ||
with op.batch_alter_table('works_history', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('report_description', sa.String(length=2000), autoincrement=False, nullable=True)) | ||
batch_op.add_column(sa.Column('epic_description', sa.Text(), autoincrement=False, nullable=True)) | ||
batch_op.add_column(sa.Column('is_high_priority', sa.Boolean(), autoincrement=False, nullable=False)) | ||
batch_op.drop_column('is_watched') | ||
batch_op.drop_column('short_description') | ||
batch_op.drop_column('is_pecp_required') | ||
batch_op.drop_column('long_description') | ||
|
||
|
||
def downgrade(): | ||
with op.batch_alter_table('works', schema=None) as batch_op: | ||
batch_op.alter_column('epic_description', new_column_name='long_description') | ||
batch_op.alter_column('report_description', new_column_name='short_description') | ||
batch_op.alter_column('is_high_priority', new_column_name='is_watched') | ||
batch_op.add_column(sa.Column('is_pecp_required', sa.Boolean(), nullable=False, default=False)) | ||
with op.batch_alter_table('works_history', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('long_description', sa.TEXT(), autoincrement=False, nullable=True)) | ||
batch_op.add_column(sa.Column('is_pecp_required', sa.BOOLEAN(), autoincrement=False, nullable=False)) | ||
batch_op.add_column(sa.Column('short_description', sa.VARCHAR(length=2000), autoincrement=False, nullable=True)) | ||
batch_op.add_column(sa.Column('is_watched', sa.BOOLEAN(), autoincrement=False, nullable=False)) | ||
batch_op.drop_column('is_high_priority') | ||
batch_op.drop_column('epic_description') | ||
batch_op.drop_column('report_description') |
92 changes: 92 additions & 0 deletions
92
epictrack-api/migrations/versions/eed10a65e3c3_make_columns_not_nullable.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,92 @@ | ||
"""make columns not nullable | ||
Revision ID: eed10a65e3c3 | ||
Revises: 2257493941e7 | ||
Create Date: 2023-10-23 16:17:27.132349 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'eed10a65e3c3' | ||
down_revision = '2257493941e7' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.execute("TRUNCATE works CASCADE") | ||
op.execute("TRUNCATE works_history CASCADE") | ||
with op.batch_alter_table('works', schema=None) as batch_op: | ||
batch_op.alter_column('eao_team_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=False) | ||
batch_op.alter_column('responsible_epd_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=False) | ||
batch_op.alter_column('work_lead_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=False) | ||
batch_op.alter_column('decision_by_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=False) | ||
|
||
with op.batch_alter_table('works_history', schema=None) as batch_op: | ||
batch_op.alter_column('eao_team_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=False, | ||
autoincrement=False) | ||
batch_op.alter_column('responsible_epd_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=False, | ||
autoincrement=False) | ||
batch_op.alter_column('work_lead_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=False, | ||
autoincrement=False) | ||
batch_op.alter_column('decision_by_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=False, | ||
autoincrement=False) | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('works_history', schema=None) as batch_op: | ||
batch_op.alter_column('decision_by_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=True, | ||
autoincrement=False) | ||
batch_op.alter_column('work_lead_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=True, | ||
autoincrement=False) | ||
batch_op.alter_column('responsible_epd_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=True, | ||
autoincrement=False) | ||
batch_op.alter_column('eao_team_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=True, | ||
autoincrement=False) | ||
|
||
with op.batch_alter_table('works', schema=None) as batch_op: | ||
batch_op.alter_column('decision_by_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=True) | ||
batch_op.alter_column('work_lead_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=True) | ||
batch_op.alter_column('responsible_epd_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=True) | ||
batch_op.alter_column('eao_team_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=True) | ||
|
||
# ### end Alembic commands ### |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.