mirror of
https://github.com/BEDOLAGA-DEV/remnawave-bedolaga-telegram-bot.git
synced 2026-03-05 05:13:21 +00:00
Remove the 7,791-line universal_migration.py and 16 incomplete individual Alembic migrations. Replace with a single initial schema migration using Base.metadata.create_all(checkfirst=True). Changes: - Add programmatic Alembic runner (app/database/migrations.py) with auto-stamp logic for existing databases transitioning from universal_migration - Extract ensure_default_web_api_token() to web_api_token_service.py - Extract sync_postgres_sequences() to database.py with SQL injection prevention via _quote_ident() - Add HMAC token hashing support with backward-compatible dual-hash fallback and automatic rehashing - Remove dead init_db() function and unused imports - Add Makefile targets: migrate, migration, migrate-stamp, migrate-history - Fix fileConfig() destroying structlog config (disable_existing_loggers) - Remove duplicate migrations/alembic/alembic.ini with credentials - Add script.py.mako template for future migration generation - Update startup flow: alembic upgrade → sync sequences → ensure token - Harden database.py: ParamSpec for retry decorator, safe URL logging, echo='debug' mode, execute_with_retry validation - Update documentation references 31 files changed, 302 insertions(+), 9,226 deletions(-)
41 lines
646 B
INI
41 lines
646 B
INI
[alembic]
|
|
script_location = migrations/alembic
|
|
prepend_sys_path = .
|
|
version_path_separator = os
|
|
sqlalchemy.url = driver://user:pass@localhost/dbname
|
|
|
|
[post_write_hooks]
|
|
|
|
[loggers]
|
|
keys = root,sqlalchemy,alembic
|
|
|
|
[handlers]
|
|
keys = console
|
|
|
|
[formatters]
|
|
keys = generic
|
|
|
|
[logger_root]
|
|
level = WARN
|
|
handlers = console
|
|
qualname =
|
|
|
|
[logger_sqlalchemy]
|
|
level = WARN
|
|
handlers =
|
|
qualname = sqlalchemy.engine
|
|
|
|
[logger_alembic]
|
|
level = INFO
|
|
handlers =
|
|
qualname = alembic
|
|
|
|
[handler_console]
|
|
class = StreamHandler
|
|
args = (sys.stderr,)
|
|
level = NOTSET
|
|
formatter = generic
|
|
|
|
[formatter_generic]
|
|
format = %(levelname)-5.5s [%(name)s] %(message)s
|
|
datefmt = %H:%M:%S |