-
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
Showing
14 changed files
with
241 additions
and
174 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
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
Generic single-database configuration. | ||
Generic single-database configuration. |
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
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
This file was deleted.
Oops, something went wrong.
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,82 @@ | ||
"""(re-7)Init | ||
Revision ID: 96ae93cc9125 | ||
Revises: | ||
Create Date: 2024-09-19 04:51:55.007209 | ||
""" | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "96ae93cc9125" | ||
down_revision = None | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"integration", | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("name", sa.String(length=255), nullable=False), | ||
sa.Column("slug", sa.String(length=255), nullable=False), | ||
sa.Column("integration_class", sa.String(length=255), nullable=True), | ||
sa.Column("config", sa.JSON(), nullable=True), | ||
sa.Column( | ||
"created_at", sa.DateTime(timezone=True), server_default=sa.text("(CURRENT_TIMESTAMP)"), nullable=False | ||
), | ||
sa.Column( | ||
"modified_at", sa.DateTime(timezone=True), server_default=sa.text("(CURRENT_TIMESTAMP)"), nullable=False | ||
), | ||
sa.PrimaryKeyConstraint("id"), | ||
sa.UniqueConstraint("slug"), | ||
) | ||
op.create_table( | ||
"user", | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("username", sa.String(length=3), nullable=False), | ||
sa.Column("email", sa.String(length=255), nullable=False), | ||
sa.Column("password", sa.String(length=255), nullable=False), | ||
sa.Column("scopes", sa.JSON(), nullable=True), | ||
sa.PrimaryKeyConstraint("id"), | ||
sa.UniqueConstraint("email"), | ||
sa.UniqueConstraint("username"), | ||
) | ||
op.create_table( | ||
"payment", | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("transaction", sa.String(length=255), nullable=False), | ||
sa.Column("amount", sa.Numeric(precision=10, scale=2), nullable=False), | ||
sa.Column("currency", sa.String(length=3), nullable=False), | ||
sa.Column("customer_email", sa.String(length=255), nullable=False), | ||
sa.Column("integration_slug", sa.String(length=255), nullable=False), | ||
sa.Column("integration_id", sa.Integer(), nullable=True), | ||
sa.Column("status", sa.String(length=10), nullable=False), | ||
sa.Column("integration_payload", sa.JSON(), nullable=True), | ||
sa.Column("integration_response", sa.JSON(), nullable=True), | ||
sa.Column( | ||
"created_at", sa.DateTime(timezone=True), server_default=sa.text("(CURRENT_TIMESTAMP)"), nullable=False | ||
), | ||
sa.Column( | ||
"modified_at", sa.DateTime(timezone=True), server_default=sa.text("(CURRENT_TIMESTAMP)"), nullable=False | ||
), | ||
sa.ForeignKeyConstraint( | ||
["integration_id"], | ||
["integration.id"], | ||
), | ||
sa.PrimaryKeyConstraint("id"), | ||
sa.UniqueConstraint("transaction"), | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table("payment") | ||
op.drop_table("user") | ||
op.drop_table("integration") | ||
# ### end Alembic commands ### |
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
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
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
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 |
---|---|---|
@@ -1,9 +1,18 @@ | ||
from sqlmodel import Session, create_engine, select | ||
from merchants.config import settings | ||
from sqlalchemy import create_engine | ||
from sqlalchemy.ext.declarative import declarative_base | ||
from sqlalchemy.orm import sessionmaker | ||
|
||
from merchants.config import settings | ||
|
||
engine = create_engine( | ||
settings.SQLALCHEMY_DATABASE_URI, | ||
settings.SQLALCHEMY_DATABASE_URL, | ||
pool_recycle=1800, | ||
pool_pre_ping=True, | ||
connect_args={"check_same_thread": False}, | ||
) | ||
SessionLocal = sessionmaker( | ||
autocommit=False, | ||
autoflush=False, | ||
bind=engine, | ||
) | ||
DatabaseModel = declarative_base() |
Oops, something went wrong.