MVP ready. Fully functional (registration? moderation, profiles vew)
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
2025-08-12 21:55:56 +09:00
parent b282c44e7c
commit 9af84db429
17 changed files with 782 additions and 18 deletions

View File

@@ -1,24 +1,42 @@
from __future__ import annotations
import os
import os, sys
from logging.config import fileConfig
from sqlalchemy import engine_from_config, pool
from alembic import context
config = context.config
# Подменяем URL из переменных окружения контейнера
if os.getenv("DATABASE_URL"):
config.set_main_option("sqlalchemy.url", os.getenv("DATABASE_URL"))
fileConfig(config.config_file_name)
# Возьми URL из переменных контейнера
db_url = os.getenv("DATABASE_URL")
if db_url:
config.set_main_option("sqlalchemy.url", db_url)
# Лог-конфиг (без падения, если секций нет)
cfg_name = config.config_file_name
if cfg_name:
try:
fileConfig(cfg_name)
except Exception:
pass
# Обеспечим PYTHONPATH=/app для импорта пакета app
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if ROOT not in sys.path:
sys.path.insert(0, ROOT)
# Метаданные моделей
from app.models.base import Base # noqa: E402
from app.models.base import Base # noqa
target_metadata = Base.metadata
def run_migrations_offline():
url = config.get_main_option("sqlalchemy.url")
context.configure(url=url, target_metadata=target_metadata, literal_binds=True,
dialect_opts={"paramstyle": "named"})
context.configure(
url=url,
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
)
with context.begin_transaction():
context.run_migrations()

View File

@@ -20,6 +20,7 @@ def upgrade():
sa.Column('id', sa.Integer(), primary_key=True, autoincrement=True),
sa.Column('telegram_id', sa.Integer(), unique=True, index=True),
sa.Column('username', sa.String(length=100), nullable=True),
sa.Column('full_name', sa.String(length=120), nullable=True),
sa.Column('gender', sa.String(length=20), nullable=True),
sa.Column('birth_date', sa.Date(), nullable=True),
@@ -30,6 +31,7 @@ def upgrade():
sa.Column('citizenship', sa.String(length=80), nullable=True),
sa.Column('visa_status', sa.String(length=60), nullable=True),
sa.Column('languages', sa.String(length=200), nullable=True),
sa.Column('education', sa.String(length=120), nullable=True),
sa.Column('occupation', sa.String(length=120), nullable=True),
sa.Column('income_range', sa.String(length=60), nullable=True),
@@ -37,19 +39,25 @@ def upgrade():
sa.Column('marital_status', sa.String(length=60), nullable=True),
sa.Column('has_children', sa.Boolean(), nullable=True),
sa.Column('children_notes', sa.String(length=200), nullable=True),
sa.Column('smoking', sa.String(length=20), nullable=True),
sa.Column('alcohol', sa.String(length=20), nullable=True),
sa.Column('health_notes', sa.String(length=300), nullable=True),
sa.Column('hobbies_tags', sa.String(length=300), nullable=True),
sa.Column('hobbies_free', sa.Text(), nullable=True),
sa.Column('goal', sa.String(length=120), nullable=True),
sa.Column('partner_prefs', sa.Text(), nullable=True),
sa.Column('avatar_file_id', sa.String(length=200), nullable=True),
sa.Column('gallery_file_ids', sa.Text(), nullable=True),
sa.Column('consent_personal', sa.Boolean(), nullable=False, server_default=sa.text('0')),
sa.Column('consent_policy', sa.Boolean(), nullable=False, server_default=sa.text('0')),
sa.Column('is_verified', sa.Boolean(), nullable=False, server_default=sa.text('0')),
sa.Column('is_active', sa.Boolean(), nullable=False, server_default=sa.text('1')),
sa.Column('created_at', sa.DateTime(), nullable=False, server_default=sa.text('CURRENT_TIMESTAMP')),
sa.Column('updated_at', sa.DateTime(), nullable=False, server_default=sa.text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP')),
)