diff --git a/backend/migrations/versions/24b8e319c0d0_new_table_for_bought_entries_with_.py b/backend/migrations/versions/24b8e319c0d0_new_table_for_bought_entries_with_.py deleted file mode 100644 index 84c50d2..0000000 --- a/backend/migrations/versions/24b8e319c0d0_new_table_for_bought_entries_with_.py +++ /dev/null @@ -1,40 +0,0 @@ -"""new table for bought entries with unknown items - -Revision ID: 24b8e319c0d0 -Revises: 015f4256bb4c -Create Date: 2024-06-02 13:14:38.681605 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '24b8e319c0d0' -down_revision = '015f4256bb4c' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('payment', schema=None) as batch_op: - batch_op.alter_column('token', - existing_type=sa.VARCHAR(length=15), - nullable=True) - batch_op.drop_constraint('payment_token_fkey', type_='foreignkey') - batch_op.create_foreign_key(None, 'login_token', ['token'], ['token']) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('payment', schema=None) as batch_op: - batch_op.drop_constraint(None, type_='foreignkey') - batch_op.create_foreign_key('payment_token_fkey', 'login_token', ['token'], ['token'], onupdate='CASCADE', ondelete='CASCADE') - batch_op.alter_column('token', - existing_type=sa.VARCHAR(length=15), - nullable=False) - - # ### end Alembic commands ### diff --git a/backend/migrations/versions/2a64d3b9235a_new_table_for_bought_entries_with_.py b/backend/migrations/versions/2a64d3b9235a_new_table_for_bought_entries_with_.py index 9290cfe..5be7818 100644 --- a/backend/migrations/versions/2a64d3b9235a_new_table_for_bought_entries_with_.py +++ b/backend/migrations/versions/2a64d3b9235a_new_table_for_bought_entries_with_.py @@ -1,7 +1,7 @@ """new table for bought entries with unknown items 2 Revision ID: 2a64d3b9235a -Revises: 24b8e319c0d0 +Revises: 015f4256bb4c Create Date: 2024-06-02 13:19:59.901053 """ @@ -11,7 +11,7 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '2a64d3b9235a' -down_revision = '24b8e319c0d0' +down_revision = '015f4256bb4c' branch_labels = None depends_on = None diff --git a/backend/models/payment.py b/backend/models/payment.py index f2f64c2..d9f7b06 100644 --- a/backend/models/payment.py +++ b/backend/models/payment.py @@ -4,7 +4,7 @@ from src import db class Payment(db.Model): id = db.Column(db.BigInteger, primary_key=True, autoincrement=True) token = db.Column(db.ForeignKey('login_token.token'), - server_onupdate=db.FetchedValue()) + server_onupdate=db.FetchedValue(), nullable=False) date = db.Column(db.Date, nullable=False, server_default=db.func.now()) amount = db.Column(db.BigInteger, nullable=False, server_default=str(0))