- Implemented SubscriptionRepository with methods to get, create, and update subscriptions. - Added BalanceTXRepository for creating and retrieving balance transactions. - Introduced a test script for simulating Pally webhook for local testing.
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
"""add subscription table
|
|
|
|
Revision ID: e8da1e4516fa
|
|
Revises: d21c5f9364ea
|
|
Create Date: 2026-04-25 16:29:08.186456
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = 'e8da1e4516fa'
|
|
down_revision: Union[str, Sequence[str], None] = 'd21c5f9364ea'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Upgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('subscriptions',
|
|
sa.Column('user_id', sa.BIGINT(), nullable=False),
|
|
sa.Column('end_date', sa.DateTime(timezone=True), nullable=False),
|
|
sa.Column('autorenew', sa.Boolean(), nullable=False),
|
|
sa.Column('status', sa.Enum('EXPIRED', 'ACTIVE', name='subscriptionstatus'), nullable=False),
|
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
|
sa.PrimaryKeyConstraint('user_id')
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table('subscriptions')
|
|
# ### end Alembic commands ###
|