From 2efa67dccac53e36f03aefcbe4cf75df20b57869 Mon Sep 17 00:00:00 2001 From: Jagadeesh B Date: Sun, 24 Nov 2024 23:35:57 +0530 Subject: [PATCH 1/3] feat(models): add DebtMintEventModel and DebtBurnEventModel --- apps/data_handler/db/models/nostra_events.py | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 apps/data_handler/db/models/nostra_events.py diff --git a/apps/data_handler/db/models/nostra_events.py b/apps/data_handler/db/models/nostra_events.py new file mode 100644 index 00000000..5e92f0c6 --- /dev/null +++ b/apps/data_handler/db/models/nostra_events.py @@ -0,0 +1,30 @@ +from decimal import Decimal +from data_handler.db.models.event import EventBaseModel +from sqlalchemy import Numeric, String +from sqlalchemy.orm import Mapped, mapped_column + + +class DebtMintEventModel(EventBaseModel): + """ + Database model for DebtMint event, inheriting from EventBaseModel. + + This model stores the user address and the amount minted. + """ + + __tablename__ = "debt_mint_event" + + user: Mapped[str] = mapped_column(String, nullable=False) + amount: Mapped[Decimal] = mapped_column(Numeric(38, 18), nullable=False) + + +class DebtBurnEventModel(EventBaseModel): + """ + Database model for DebtBurn event, inheriting from EventBaseModel. + + This model stores the user address and the amount burned. + """ + + __tablename__ = "debt_burn_event" + + user: Mapped[str] = mapped_column(String, nullable=False) + amount: Mapped[Decimal] = mapped_column(Numeric(38, 18), nullable=False) From 5d9b791093a25e55e673d33354d60dce73fc1ef0 Mon Sep 17 00:00:00 2001 From: Jagadeeshftw Date: Sun, 24 Nov 2024 20:11:34 +0000 Subject: [PATCH 2/3] Add migration for DebtMintEventModel and DebtBurnEventModel tables --- ...06428099929_add_debtminteventmodel_and_.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 apps/data_handler/migrations/versions/c06428099929_add_debtminteventmodel_and_.py diff --git a/apps/data_handler/migrations/versions/c06428099929_add_debtminteventmodel_and_.py b/apps/data_handler/migrations/versions/c06428099929_add_debtminteventmodel_and_.py new file mode 100644 index 00000000..9e7486f6 --- /dev/null +++ b/apps/data_handler/migrations/versions/c06428099929_add_debtminteventmodel_and_.py @@ -0,0 +1,30 @@ +"""add DebtMintEventModel and DebtBurnEventModel tables + +Revision ID: c06428099929 +Revises: d3691f6e8c5a +Create Date: 2024-11-24 20:03:49.515837 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = 'c06428099929' +down_revision: Union[str, None] = 'd3691f6e8c5a' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + pass + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + pass + # ### end Alembic commands ### From 2699e6f82e0171fe010448d9bff620f3004f21cf Mon Sep 17 00:00:00 2001 From: Jagadeeshftw Date: Mon, 25 Nov 2024 07:38:50 +0000 Subject: [PATCH 3/3] remove migration file --- ...06428099929_add_debtminteventmodel_and_.py | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 apps/data_handler/migrations/versions/c06428099929_add_debtminteventmodel_and_.py diff --git a/apps/data_handler/migrations/versions/c06428099929_add_debtminteventmodel_and_.py b/apps/data_handler/migrations/versions/c06428099929_add_debtminteventmodel_and_.py deleted file mode 100644 index 9e7486f6..00000000 --- a/apps/data_handler/migrations/versions/c06428099929_add_debtminteventmodel_and_.py +++ /dev/null @@ -1,30 +0,0 @@ -"""add DebtMintEventModel and DebtBurnEventModel tables - -Revision ID: c06428099929 -Revises: d3691f6e8c5a -Create Date: 2024-11-24 20:03:49.515837 - -""" -from typing import Sequence, Union - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision: str = 'c06428099929' -down_revision: Union[str, None] = 'd3691f6e8c5a' -branch_labels: Union[str, Sequence[str], None] = None -depends_on: Union[str, Sequence[str], None] = None - - -def upgrade() -> None: - # ### commands auto generated by Alembic - please adjust! ### - pass - # ### end Alembic commands ### - - -def downgrade() -> None: - # ### commands auto generated by Alembic - please adjust! ### - pass - # ### end Alembic commands ###