Compare commits

...

2 Commits

Author SHA1 Message Date
mo
1ccd4456f6 Merge pull request 'refactor: Encapsulate enum creation logic within a dedicated function in the upgrade process for improved readability and maintainability' (#36) from ph4 into prod
Reviewed-on: #36
2025-06-01 18:15:41 +02:00
mohamad
c14b432082 refactor: Encapsulate enum creation logic within a dedicated function in the upgrade process for improved readability and maintainability
All checks were successful
Deploy to Production, build images and push to Gitea Registry / build_and_push (pull_request) Successful in 1m21s
2025-06-01 18:15:22 +02:00

View File

@ -26,13 +26,16 @@ chore_frequency_enum = postgresql.ENUM('one_time', 'daily', 'weekly', 'monthly',
chore_type_enum = postgresql.ENUM('personal', 'group', name='choretypeenum', create_type=False) chore_type_enum = postgresql.ENUM('personal', 'group', name='choretypeenum', create_type=False)
def upgrade(context) -> None: def upgrade(context) -> None:
user_role_enum.create(op.get_bind(), checkfirst=True) def create_enums():
split_type_enum.create(op.get_bind(), checkfirst=True) user_role_enum.create(op.get_bind(), checkfirst=True)
expense_split_status_enum.create(op.get_bind(), checkfirst=True) split_type_enum.create(op.get_bind(), checkfirst=True)
expense_overall_status_enum.create(op.get_bind(), checkfirst=True) expense_split_status_enum.create(op.get_bind(), checkfirst=True)
recurrence_type_enum.create(op.get_bind(), checkfirst=True) expense_overall_status_enum.create(op.get_bind(), checkfirst=True)
chore_frequency_enum.create(op.get_bind(), checkfirst=True) recurrence_type_enum.create(op.get_bind(), checkfirst=True)
chore_type_enum.create(op.get_bind(), checkfirst=True) chore_frequency_enum.create(op.get_bind(), checkfirst=True)
chore_type_enum.create(op.get_bind(), checkfirst=True)
create_enums()
op.create_table('users', op.create_table('users',
sa.Column('id', sa.Integer(), nullable=False), sa.Column('id', sa.Integer(), nullable=False),