diff --git a/ihatemoney/migrations/versions/7a9b38559992_new_bill_type_attribute_added.py b/ihatemoney/migrations/versions/7a9b38559992_new_bill_type_attribute_added.py index 0a4ce577..9b1fc520 100644 --- a/ihatemoney/migrations/versions/7a9b38559992_new_bill_type_attribute_added.py +++ b/ihatemoney/migrations/versions/7a9b38559992_new_bill_type_attribute_added.py @@ -16,10 +16,16 @@ from ihatemoney.models import BillType def upgrade(): - op.add_column("bill", sa.Column("bill_type", sa.Enum(BillType), server_default=BillType.EXPENSE.name)) + billtype_enum = sa.Enum(BillType) + billtype_enum.create(op.get_bind(), checkfirst=True) + + op.add_column("bill", sa.Column("bill_type", billtype_enum, server_default=BillType.EXPENSE.name)) op.add_column("bill_version", sa.Column("bill_type", sa.UnicodeText())) def downgrade(): op.drop_column("bill", "bill_type") op.drop_column("bill_version", "bill_type") + + billtype_enum = sa.Enum(BillType) + billtype_enum.drop(op.get_bind()) \ No newline at end of file