diff --git a/app/models/loan_charge.py b/app/models/loan_charge.py index 00b3606..a9ed283 100644 --- a/app/models/loan_charge.py +++ b/app/models/loan_charge.py @@ -53,14 +53,14 @@ class LoanCharge(db.Model): amount = (percent / 100.0) * referenced_amount charge_obj = cls( - loan_id=loan_id, - transaction_id=charge.get("transaction_id"), - code=charge.get("code"), - amount=amount, - percent=percent, - description=charge.get("description", ""), - due=due_days, - due_date=now + timedelta(days=due_days) + loan_id = loan_id, + transaction_id = transaction_id, + code = charge.get("code"), + amount = amount, + percent = percent, + description = charge.get("description", ""), + due = due_days, + due_date = now + timedelta(days=due_days) ) db.session.add(charge_obj) diff --git a/migrations/versions/ec8d97f9b584_migration_on_thu_apr_17_10_40_05_utc_.py b/migrations/versions/ec8d97f9b584_migration_on_thu_apr_17_10_40_05_utc_.py new file mode 100644 index 0000000..1cf6d46 --- /dev/null +++ b/migrations/versions/ec8d97f9b584_migration_on_thu_apr_17_10_40_05_utc_.py @@ -0,0 +1,34 @@ +"""Migration on Thu Apr 17 10:40:05 UTC 2025 + +Revision ID: ec8d97f9b584 +Revises: 287ecb02d3d7 +Create Date: 2025-04-17 10:40:34.751272 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'ec8d97f9b584' +down_revision = '287ecb02d3d7' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('loan_charges', schema=None) as batch_op: + batch_op.add_column(sa.Column('transaction_id', sa.String(length=50), nullable=True)) + batch_op.add_column(sa.Column('due_date', sa.DateTime(), nullable=True)) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('loan_charges', schema=None) as batch_op: + batch_op.drop_column('due_date') + batch_op.drop_column('transaction_id') + + # ### end Alembic commands ###