Use enum name instead of value as SQL server_default

SQLAlchemy uses the Enum names in the database, as the values could be
generic python objects.
https://docs.sqlalchemy.org/en/20/core/type_basics.html#sqlalchemy.types.Enum
This commit is contained in:
Tom Roussel 2024-03-03 10:30:00 +01:00
parent 8acbf714f7
commit 0e2534fb12

View file

@ -16,7 +16,7 @@ from ihatemoney.models import BillType
def upgrade():
op.add_column("bill", sa.Column("bill_type", sa.Enum(BillType), server_default=BillType.EXPENSE.value))
op.add_column("bill", sa.Column("bill_type", sa.Enum(BillType), server_default=BillType.EXPENSE.name))
op.add_column("bill_version", sa.Column("bill_type", sa.UnicodeText()))