feat: integrated pally webhook (draft, needs rewrite)
This commit is contained in:
45
alembic/versions/3d767875ec7d_transactions.py
Normal file
45
alembic/versions/3d767875ec7d_transactions.py
Normal file
@@ -0,0 +1,45 @@
|
||||
"""+transactions
|
||||
|
||||
Revision ID: 3d767875ec7d
|
||||
Revises: 8686021972e9
|
||||
Create Date: 2026-08-01 23:40:43.069199
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '3d767875ec7d'
|
||||
down_revision: Union[str, Sequence[str], None] = '8686021972e9'
|
||||
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('balance_transactions',
|
||||
sa.Column('id', sa.BIGINT(), autoincrement=True, nullable=False),
|
||||
sa.Column('user_id', sa.BIGINT(), nullable=False),
|
||||
sa.Column('amount', sa.INTEGER(), nullable=False),
|
||||
sa.Column('tx_type', sa.Enum('deposit', 'purchase', 'refund', 'referral', 'manual', 'autorenew', 'manual_renew', name='balancetxtype'), nullable=False),
|
||||
sa.Column('balance_before', sa.INTEGER(), nullable=False),
|
||||
sa.Column('balance_after', sa.INTEGER(), nullable=False),
|
||||
sa.Column('description', sa.TEXT(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_balance_transactions_user_id'), 'balance_transactions', ['user_id'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('ix_balance_transactions_user_id'), table_name='balance_transactions')
|
||||
op.drop_table('balance_transactions')
|
||||
# ### end Alembic commands ###
|
||||
38
alembic/versions/8101e7820b1e_balance_float_2.py
Normal file
38
alembic/versions/8101e7820b1e_balance_float_2.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""balance->float(2)
|
||||
|
||||
Revision ID: 8101e7820b1e
|
||||
Revises: f1bb7c46f6f6
|
||||
Create Date: 2026-08-01 23:16:59.561628
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '8101e7820b1e'
|
||||
down_revision: Union[str, Sequence[str], None] = 'f1bb7c46f6f6'
|
||||
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.alter_column('users', 'balance',
|
||||
existing_type=sa.REAL(),
|
||||
type_=sa.FLOAT(precision=2),
|
||||
existing_nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('users', 'balance',
|
||||
existing_type=sa.FLOAT(precision=2),
|
||||
type_=sa.REAL(),
|
||||
existing_nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
32
alembic/versions/8686021972e9_balance_real_psql_tweaking.py
Normal file
32
alembic/versions/8686021972e9_balance_real_psql_tweaking.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""balance->REAL -- psql tweaking
|
||||
|
||||
Revision ID: 8686021972e9
|
||||
Revises: 8101e7820b1e
|
||||
Create Date: 2026-08-01 23:17:44.635690
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '8686021972e9'
|
||||
down_revision: Union[str, Sequence[str], None] = '8101e7820b1e'
|
||||
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! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
34
alembic/versions/c58e44d15cca_user_balance.py
Normal file
34
alembic/versions/c58e44d15cca_user_balance.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""+user.balance
|
||||
|
||||
Revision ID: c58e44d15cca
|
||||
Revises: e237f7c5cb9a
|
||||
Create Date: 2026-08-01 22:59:28.814554
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'c58e44d15cca'
|
||||
down_revision: Union[str, Sequence[str], None] = 'e237f7c5cb9a'
|
||||
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_unique_constraint(None, 'invoices', ['id'])
|
||||
op.add_column('users', sa.Column('balance', sa.FLOAT(precision=2), nullable=False))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('users', 'balance')
|
||||
op.drop_constraint(None, 'invoices', type_='unique')
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,68 @@
|
||||
"""user.id -> INTEGER, +user.referal_id
|
||||
|
||||
Revision ID: f1bb7c46f6f6
|
||||
Revises: c58e44d15cca
|
||||
Create Date: 2026-08-01 23:14:21.719693
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'f1bb7c46f6f6'
|
||||
down_revision: Union[str, Sequence[str], None] = 'c58e44d15cca'
|
||||
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.alter_column('invoices', 'creator_id',
|
||||
existing_type=sa.BIGINT(),
|
||||
type_=sa.INTEGER(),
|
||||
existing_nullable=False)
|
||||
op.alter_column('sessions', 'user_id',
|
||||
existing_type=sa.BIGINT(),
|
||||
type_=sa.INTEGER(),
|
||||
existing_nullable=False)
|
||||
op.add_column('users', sa.Column('referal_id', sa.INTEGER(), nullable=True))
|
||||
op.alter_column('users', 'id',
|
||||
existing_type=sa.BIGINT(),
|
||||
type_=sa.INTEGER(),
|
||||
existing_nullable=False,
|
||||
autoincrement=True)
|
||||
op.alter_column('users', 'balance',
|
||||
existing_type=sa.REAL(),
|
||||
type_=sa.FLOAT(precision=2),
|
||||
existing_nullable=False)
|
||||
op.create_foreign_key(None, 'users', 'users', ['referal_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'users', type_='foreignkey')
|
||||
op.alter_column('users', 'balance',
|
||||
existing_type=sa.FLOAT(precision=2),
|
||||
type_=sa.REAL(),
|
||||
existing_nullable=False)
|
||||
op.alter_column('users', 'id',
|
||||
existing_type=sa.INTEGER(),
|
||||
type_=sa.BIGINT(),
|
||||
existing_nullable=False,
|
||||
autoincrement=True)
|
||||
op.drop_column('users', 'referal_id')
|
||||
op.alter_column('sessions', 'user_id',
|
||||
existing_type=sa.INTEGER(),
|
||||
type_=sa.BIGINT(),
|
||||
existing_nullable=False)
|
||||
op.alter_column('invoices', 'creator_id',
|
||||
existing_type=sa.INTEGER(),
|
||||
type_=sa.BIGINT(),
|
||||
existing_nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user