-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c48fa2b
commit 5c47b4b
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import traceback | ||
|
||
from api import db | ||
from api.utils.loggingutils import logger | ||
|
||
|
||
def save(data): | ||
try: | ||
db.session.add(data) | ||
db.session.commit() | ||
except Exception as e: | ||
logger.error( | ||
"Error occurred while committing the data in the database." | ||
f"Error message: {e}" | ||
) | ||
logger.debug(traceback.format_exc()) | ||
db.session.rollback() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Initial migration. | ||
Revision ID: 70bea50174bf | ||
Revises: | ||
Create Date: 2024-04-18 17:18:19.882178 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "70bea50174bf" | ||
down_revision = None | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"webhook_transaction_log", | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("payload", sa.Text(), nullable=True), | ||
sa.Column("processed", sa.Boolean(), nullable=False), | ||
sa.Column("attempts", sa.Integer(), nullable=False), | ||
sa.Column("created_on", sa.DateTime(), nullable=True), | ||
sa.Column("updated_on", sa.DateTime(), nullable=True), | ||
sa.PrimaryKeyConstraint("id"), | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table("webhook_transaction_log") | ||
# ### end Alembic commands ### |