Compare commits
2 Commits
fe23306adb
...
8eca76b844
| Author | SHA1 | Date | |
|---|---|---|---|
| 8eca76b844 | |||
| d263730cf2 |
@@ -5,15 +5,14 @@
|
|||||||
BOT_TOKEN=8125171867:AAHA0l2hGGodOUBh0rFlkE4CxK0X6JzZv64
|
BOT_TOKEN=8125171867:AAHA0l2hGGodOUBh0rFlkE4CxK0X6JzZv64
|
||||||
|
|
||||||
# PostgreSQL настройки для Docker контейнера
|
# PostgreSQL настройки для Docker контейнера
|
||||||
POSTGRES_HOST=postgres
|
POSTGRES_HOST=192.168.0.102
|
||||||
POSTGRES_PORT=5432
|
POSTGRES_PORT=5432
|
||||||
POSTGRES_DB=lottery_bot
|
POSTGRES_DB=lottery_bot
|
||||||
POSTGRES_USER=lottery_user
|
POSTGRES_USER=trevor
|
||||||
POSTGRES_PASSWORD=Cl0ud_1985!
|
POSTGRES_PASSWORD=Cl0ud_1985!
|
||||||
|
|
||||||
# Database URL для бота (использует postgres как hostname внутри Docker сети)
|
# Database URL для бота (использует postgres как hostname внутри Docker сети)
|
||||||
DATABASE_URL=postgresql+asyncpg://lottery_user:Cl0ud_1985!@postgres:5432/lottery_bot
|
DATABASE_URL=postgresql+asyncpg://trevor:Cl0ud_1985!@192.168.0.102:5432/lottery_bot
|
||||||
|
|
||||||
# Redis URL
|
# Redis URL
|
||||||
REDIS_URL=redis://redis:6379/0
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
|
||||||
|
|||||||
88
migrations/versions/20260217_0032_55_12efff9b8e0c_.py
Normal file
88
migrations/versions/20260217_0032_55_12efff9b8e0c_.py
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
"""
|
||||||
|
|
||||||
|
Revision ID: 12efff9b8e0c
|
||||||
|
Revises: b4c435a7dc5f
|
||||||
|
Create Date: 2026-02-17 00:32:55.244678
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '12efff9b8e0c'
|
||||||
|
down_revision = 'b4c435a7dc5f'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.create_table('blocked_users',
|
||||||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
|
sa.Column('telegram_id', sa.BigInteger(), nullable=False),
|
||||||
|
sa.Column('error_type', sa.String(length=100), nullable=False),
|
||||||
|
sa.Column('error_message', sa.Text(), nullable=True),
|
||||||
|
sa.Column('first_blocked_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column('last_attempt_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column('attempt_count', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('is_active', sa.Boolean(), nullable=True),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_index(op.f('ix_blocked_users_is_active'), 'blocked_users', ['is_active'], unique=False)
|
||||||
|
op.create_index(op.f('ix_blocked_users_telegram_id'), 'blocked_users', ['telegram_id'], unique=True)
|
||||||
|
op.create_table('broadcast_channels',
|
||||||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
|
sa.Column('chat_id', sa.BigInteger(), nullable=False),
|
||||||
|
sa.Column('chat_type', sa.String(length=20), nullable=False),
|
||||||
|
sa.Column('title', sa.String(length=255), nullable=False),
|
||||||
|
sa.Column('username', sa.String(length=255), nullable=True),
|
||||||
|
sa.Column('description', sa.Text(), nullable=True),
|
||||||
|
sa.Column('is_active', sa.Boolean(), nullable=True),
|
||||||
|
sa.Column('added_by', sa.Integer(), nullable=False),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['added_by'], ['users.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_index(op.f('ix_broadcast_channels_chat_id'), 'broadcast_channels', ['chat_id'], unique=True)
|
||||||
|
op.create_index(op.f('ix_broadcast_channels_is_active'), 'broadcast_channels', ['is_active'], unique=False)
|
||||||
|
op.create_table('broadcast_logs',
|
||||||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
|
sa.Column('broadcast_type', sa.String(length=20), nullable=False),
|
||||||
|
sa.Column('target_id', sa.BigInteger(), nullable=True),
|
||||||
|
sa.Column('message_type', sa.String(length=20), nullable=False),
|
||||||
|
sa.Column('message_text', sa.Text(), nullable=True),
|
||||||
|
sa.Column('file_id', sa.String(length=255), nullable=True),
|
||||||
|
sa.Column('total_recipients', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('success_count', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('failed_count', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('blocked_count', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('created_by', sa.Integer(), nullable=False),
|
||||||
|
sa.Column('started_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column('completed_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column('status', sa.String(length=20), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['created_by'], ['users.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_index(op.f('ix_broadcast_logs_broadcast_type'), 'broadcast_logs', ['broadcast_type'], unique=False)
|
||||||
|
op.create_index(op.f('ix_broadcast_logs_status'), 'broadcast_logs', ['status'], unique=False)
|
||||||
|
op.add_column('users', sa.Column('is_chat_banned', sa.Boolean(), nullable=True))
|
||||||
|
op.add_column('users', sa.Column('last_activity', sa.DateTime(timezone=True), nullable=True))
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_column('users', 'last_activity')
|
||||||
|
op.drop_column('users', 'is_chat_banned')
|
||||||
|
op.drop_index(op.f('ix_broadcast_logs_status'), table_name='broadcast_logs')
|
||||||
|
op.drop_index(op.f('ix_broadcast_logs_broadcast_type'), table_name='broadcast_logs')
|
||||||
|
op.drop_table('broadcast_logs')
|
||||||
|
op.drop_index(op.f('ix_broadcast_channels_is_active'), table_name='broadcast_channels')
|
||||||
|
op.drop_index(op.f('ix_broadcast_channels_chat_id'), table_name='broadcast_channels')
|
||||||
|
op.drop_table('broadcast_channels')
|
||||||
|
op.drop_index(op.f('ix_blocked_users_telegram_id'), table_name='blocked_users')
|
||||||
|
op.drop_index(op.f('ix_blocked_users_is_active'), table_name='blocked_users')
|
||||||
|
op.drop_table('blocked_users')
|
||||||
|
# ### end Alembic commands ###
|
||||||
28
migrations/versions/20260217_0034_52_cd31303a681c_.py
Normal file
28
migrations/versions/20260217_0034_52_cd31303a681c_.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
"""
|
||||||
|
|
||||||
|
Revision ID: cd31303a681c
|
||||||
|
Revises: 12efff9b8e0c
|
||||||
|
Create Date: 2026-02-17 00:34:52.644231
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'cd31303a681c'
|
||||||
|
down_revision = '12efff9b8e0c'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = 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 ###
|
||||||
Reference in New Issue
Block a user