diff --git a/epictrack-api/migrations/versions/09a79ca8e8fd_add_none_ministry.py b/epictrack-api/migrations/versions/09a79ca8e8fd_add_none_ministry.py new file mode 100644 index 000000000..fb7cd5e7a --- /dev/null +++ b/epictrack-api/migrations/versions/09a79ca8e8fd_add_none_ministry.py @@ -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 ### diff --git a/epictrack-web/src/components/work/WorkForm/index.tsx b/epictrack-web/src/components/work/WorkForm/index.tsx index c02b6167f..a228ec8ea 100644 --- a/epictrack-web/src/components/work/WorkForm/index.tsx +++ b/epictrack-web/src/components/work/WorkForm/index.tsx @@ -32,6 +32,7 @@ const schema = yup.object().shape({ work_type_id: yup.number().required("Work type is required"), start_date: yup.date().required("Start date is required"), project_id: yup.number().required("Project is required"), + ministry_id: yup.number().required("Responsible Ministry is required"), federal_involvement_id: yup .number() .required("Federal Involvement is required"), @@ -279,7 +280,7 @@ export default function WorkForm({ ...props }) { > - Responsible Ministry + Responsible Ministry