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
This commit is contained in:
mo 2025-06-01 18:15:41 +02:00
commit 1ccd4456f6

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)
def upgrade(context) -> None:
user_role_enum.create(op.get_bind(), checkfirst=True)
split_type_enum.create(op.get_bind(), checkfirst=True)
expense_split_status_enum.create(op.get_bind(), checkfirst=True)
expense_overall_status_enum.create(op.get_bind(), checkfirst=True)
recurrence_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)
def create_enums():
user_role_enum.create(op.get_bind(), checkfirst=True)
split_type_enum.create(op.get_bind(), checkfirst=True)
expense_split_status_enum.create(op.get_bind(), checkfirst=True)
expense_overall_status_enum.create(op.get_bind(), checkfirst=True)
recurrence_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',
sa.Column('id', sa.Integer(), nullable=False),