Skip to content

fix(migrations): Add alembic.ini file#31

Merged
Fl1riX merged 1 commit into
mainfrom
fix/add-alembic-ini
Jun 1, 2026
Merged

fix(migrations): Add alembic.ini file#31
Fl1riX merged 1 commit into
mainfrom
fix/add-alembic-ini

Conversation

@Fl1riX

@Fl1riX Fl1riX commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary by Sourcery

Build:

  • Добавлен файл конфигурации alembic.ini, указывающий расположение скриптов Alembic и настройки логирования.
Original summary in English

Summary by Sourcery

Build:

  • Add alembic.ini configuration file pointing to the Alembic scripts location and logging setup.

@sourcery-ai

sourcery-ai Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Руководство для ревьюера

Добавляет конфигурационный файл Alembic и гарантирует, что он отслеживается в репозитории, обеспечивая единообразное поведение миграций и настройку логирования во всех средах.

Изменения на уровне файлов

Change Details Files
Введение стандартного конфигурационного файла Alembic для управления расположением миграционных скриптов и поведением логирования.
  • Создать alembic.ini с базовой конфигурацией секции [alembic], указывающей на директорию со скриптами Alembic и настраивающей sys.path
  • Настроить секции логирования для корневого логгера, логгеров SQLAlchemy и Alembic с консольным обработчиком и общим форматтером
  • Задать уровни логирования (WARN для корневого логгера и SQLAlchemy, INFO для Alembic) и лаконичный формат сообщений логов
alembic.ini

Подсказки и команды

Взаимодействие с Sourcery

  • Запустить новое ревью: Оставьте комментарий @sourcery-ai review в pull request.
  • Продолжить обсуждение: Отвечайте напрямую на комментарии ревью от Sourcery.
  • Создать задачу GitHub из комментария ревью: Попросите Sourcery создать
    задачу из комментария ревью, ответив на него. Также вы можете ответить на
    комментарий ревью с @sourcery-ai issue, чтобы создать задачу на его основе.
  • Сгенерировать заголовок pull request: Напишите @sourcery-ai в любом месте
    заголовка pull request, чтобы сгенерировать заголовок в любой момент. Также можно
    оставить комментарий @sourcery-ai title в pull request, чтобы (повторно) сгенерировать
    заголовок в любой момент.
  • Сгенерировать краткое описание pull request: Напишите @sourcery-ai summary
    в любом месте тела pull request, чтобы сгенерировать краткое описание PR в любой момент
    именно там, где вы хотите. Также можно оставить комментарий
    @sourcery-ai summary в pull request, чтобы (повторно) сгенерировать
    краткое описание в любой момент.
  • Сгенерировать руководство для ревьюера: Оставьте комментарий
    @sourcery-ai guide в pull request, чтобы (повторно) сгенерировать руководство
    для ревьюера в любой момент.
  • Разрешить все комментарии Sourcery: Оставьте комментарий
    @sourcery-ai resolve в pull request, чтобы пометить все комментарии Sourcery
    как разрешённые. Полезно, если вы уже учли все замечания и не хотите видеть их дальше.
  • Отклонить все ревью Sourcery: Оставьте комментарий
    @sourcery-ai dismiss в pull request, чтобы отклонить все существующие ревью
    от Sourcery. Особенно полезно, если вы хотите начать с чистого листа —
    не забудьте затем оставить комментарий @sourcery-ai review, чтобы запустить новое ревью!

Настройка под себя

Откройте свою панель управления, чтобы:

  • Включать или отключать функции ревью, такие как сгенерированное Sourcery
    краткое описание pull request, руководство для ревьюера и другие.
  • Изменить язык ревью.
  • Добавлять, удалять или редактировать собственные инструкции для ревью.
  • Настраивать другие параметры ревью.

Получение помощи

Original review guide in English

Reviewer's Guide

Adds an Alembic configuration file and ensures it is tracked, enabling consistent migration behavior and logging configuration in all environments.

File-Level Changes

Change Details Files
Introduce a standard Alembic configuration file to control migration script location and logging behavior.
  • Create alembic.ini with basic [alembic] configuration pointing to the alembic scripts directory and adjusting sys.path
  • Configure logging sections for root, SQLAlchemy, and Alembic loggers with console handler and generic formatter
  • Set log levels (WARN for root and SQLAlchemy, INFO for Alembic) and a concise log message format
alembic.ini

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Привет — я посмотрел(а) ваши изменения, и они выглядят отлично!


Sourcery бесплатен для open source-проектов — если вам нравятся наши обзоры, пожалуйста, поделитесь ими ✨
Помогите мне стать полезнее! Пожалуйста, нажимайте 👍 или 👎 на каждом комментарии, и я буду использовать этот фидбек, чтобы улучшать обзоры.
Original comment in English

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Fl1riX Fl1riX merged commit 249c71f into main Jun 1, 2026
4 checks passed
@Fl1riX Fl1riX deleted the fix/add-alembic-ini branch June 1, 2026 11:34
@coveralls

coveralls commented Jun 1, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 26752312806

Coverage remained the same at 30.167%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1200
Covered Lines: 362
Line Coverage: 30.17%
Coverage Strength: 0.6 hits per line

💛 - Coveralls

Fl1riX added a commit that referenced this pull request Jun 2, 2026
Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>
Fl1riX added a commit that referenced this pull request Jun 2, 2026
* delete cloudflared.deb"

* feat(models): Start implementing the role system, add a ban table, and fix date fields by adding the timezone=True property to store time zone information. Fix and add missing relationships

* chore(.gitignore): remove tracking of different caches

* refactor(tg_link): rename MagicTokens to MagicToken

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(bot): send login-link URL on start when telegram is not linked

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(auth): add JWT unit tests

Co-authored-by: Cursor <cursoragent@cursor.com>

* refactor(models): Improve the readability of field checks in the bans table

* feat(models): Add validation of the revoked_at field at the database level

* feat(models): Add checks for the expires_at and revoked_at fields, and also fix the issue of multiple bans for one user simultaneously, while preserving the ban history.

* refactor(models): Rename MagicTokens to MagicToken across the codebase for consistency

* fix(modedls): Add foreigkey to the appointments table relationship

* Fix/backround clear magic tokens (#17)

* delete cloudflared.deb"

* feat(models): Start implementing the role system, add a ban table, and fix date fields by adding the timezone=True property to store time zone information. Fix and add missing relationships

* chore(.gitignore): remove tracking of different caches

* refactor(tg_link): rename MagicTokens to MagicToken

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(bot): send login-link URL on start when telegram is not linked

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(auth): add JWT unit tests

Co-authored-by: Cursor <cursoragent@cursor.com>

* refactor(models): Improve the readability of field checks in the bans table

* feat(models): Add validation of the revoked_at field at the database level

* feat(models): Add checks for the expires_at and revoked_at fields, and also fix the issue of multiple bans for one user simultaneously, while preserving the ban history.

* refactor(models): Rename MagicTokens to MagicToken across the codebase for consistency

* fix(modedls): Add foreigkey to the appointments table relationship

* fix(tasks): Fix database issues with the background task for clearing magic tokens

---------

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(ci): Add Docker image building and pushing to the ghcr registry (#18)

* feat(ci): Add Docker image building and pushing to the ghcr registry

* feat(docker-compose): Add watchtower to query the registry and download dcoker images from there.

* feat(ci): Add a commit hash tag to Docker images

* chore: remove old SSH deploy workflow (#19)

* Fix/put things in order (#20)

* fix: Remove the get_db file from infrastructure and remove logging of all SQL queries to reduce the IO load.

* chore(jwt): Remove dprecated definition of the current time

* fix(compose): Fix port forwarding to localhost only (#21)

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* fix(compose): Fix the error of accessing the database outside the local network (#22)

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* Revert "fix(compose): Fix the error of accessing the database outside the local network (#22)" (#23)

This reverts commit 73920aa.

* Fix/magic link bot auth (#24)

* fix(auth): Fix a vulnerability in the process of linking a Telegram bot to an account by adding X-Bot-Secret to the header

* chore(auth): Improve logging of the create_telegram_magic_link function

* fix(auth): Fix X-Bot-Secret authentication. Eliminates timig attack.

* chore(requirements): update requrements.txt list

* fix(bot): Add sending of the X-Bot-Secret header from the Telegram bot

* fix(config): Remove os.environ, which causes an error in tests

* Update comment src/presentation/api/v1/auth/tg_link.py

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

* docs(services): Fix logging and doc string errors

---------

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

* Feature/docker security improvements (#25)

* feat(docker): Isolate services by separating docker networks

* feat(docker): Add a system user app. Remove buffering and .pyc, __pycache__ files.

* feat(docker): Remove root privileges. Add cap_drop to disable root privileges. Enable write access to the /tmp folder.

* feat(logger): Remove logging to a file

* feat(docker): Write a user creation command in the api container and transfer the user change to the bot container

* docs: Correct syntax errors

---------

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* fix: Add && to the docker image build command (#27)

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* Feature/heartbit endpoint (#28)

* feat: Add a health endpoint to check if the API is online

* feat(docker): Add cleaning of outdated Docker images

* fix: Change your HealthCheck internet connection to avoid being blocked by RateLimiting

---------

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* feat: Bring the architecture to a clean archeticture. In the structur… (#29)

* feat: Bring the architecture to a clean archeticture. In the structure, repeat the project structure for easier navigation. Separate the models into different files.

* fix(models): Fix circular import

* fix(models): Fix circular import

* fix(models): correct error texts in models

---------

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* Fix/alembic migrations (#30)

* fix: Delete alembic.ini

* chore: add alembic.ini into .gitignore

* chore: update alembic scheme

* fix: Remove the backup key from config.py

* fix: Fix the SECRET_KEY test environment variable

* fix(auth): Fixing a missing SECRET_KEY error in .env

* fix(tests): Fix E401 [*] Multiple imports on one line

* feat(config): Add a check for the absence of DATABSE_URL in .env

* Add a database engine to lifespan's fastapi

* refactor: Move session factory to lifespan

---------

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* fix(migrations): Add alembic.ini file (#31)

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* refactor: refactor: simplify ban uniqueness constraint and database session handling

* feat(tasks): add background task for revoking expired bans

---------

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Fl1riX added a commit that referenced this pull request Jun 2, 2026
* delete cloudflared.deb"

* feat(models): Start implementing the role system, add a ban table, and fix date fields by adding the timezone=True property to store time zone information. Fix and add missing relationships

* chore(.gitignore): remove tracking of different caches

* refactor(tg_link): rename MagicTokens to MagicToken

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(bot): send login-link URL on start when telegram is not linked

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(auth): add JWT unit tests

Co-authored-by: Cursor <cursoragent@cursor.com>

* refactor(models): Improve the readability of field checks in the bans table

* feat(models): Add validation of the revoked_at field at the database level

* feat(models): Add checks for the expires_at and revoked_at fields, and also fix the issue of multiple bans for one user simultaneously, while preserving the ban history.

* refactor(models): Rename MagicTokens to MagicToken across the codebase for consistency

* fix(modedls): Add foreigkey to the appointments table relationship

* Fix/backround clear magic tokens (#17)

* delete cloudflared.deb"

* feat(models): Start implementing the role system, add a ban table, and fix date fields by adding the timezone=True property to store time zone information. Fix and add missing relationships

* chore(.gitignore): remove tracking of different caches

* refactor(tg_link): rename MagicTokens to MagicToken

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(bot): send login-link URL on start when telegram is not linked

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(auth): add JWT unit tests

Co-authored-by: Cursor <cursoragent@cursor.com>

* refactor(models): Improve the readability of field checks in the bans table

* feat(models): Add validation of the revoked_at field at the database level

* feat(models): Add checks for the expires_at and revoked_at fields, and also fix the issue of multiple bans for one user simultaneously, while preserving the ban history.

* refactor(models): Rename MagicTokens to MagicToken across the codebase for consistency

* fix(modedls): Add foreigkey to the appointments table relationship

* fix(tasks): Fix database issues with the background task for clearing magic tokens

---------

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(ci): Add Docker image building and pushing to the ghcr registry (#18)

* feat(ci): Add Docker image building and pushing to the ghcr registry

* feat(docker-compose): Add watchtower to query the registry and download dcoker images from there.

* feat(ci): Add a commit hash tag to Docker images

* chore: remove old SSH deploy workflow (#19)

* Fix/put things in order (#20)

* fix: Remove the get_db file from infrastructure and remove logging of all SQL queries to reduce the IO load.

* chore(jwt): Remove dprecated definition of the current time

* fix(compose): Fix port forwarding to localhost only (#21)

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* fix(compose): Fix the error of accessing the database outside the local network (#22)

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* Revert "fix(compose): Fix the error of accessing the database outside the local network (#22)" (#23)

This reverts commit 73920aa.

* Fix/magic link bot auth (#24)

* fix(auth): Fix a vulnerability in the process of linking a Telegram bot to an account by adding X-Bot-Secret to the header

* chore(auth): Improve logging of the create_telegram_magic_link function

* fix(auth): Fix X-Bot-Secret authentication. Eliminates timig attack.

* chore(requirements): update requrements.txt list

* fix(bot): Add sending of the X-Bot-Secret header from the Telegram bot

* fix(config): Remove os.environ, which causes an error in tests

* Update comment src/presentation/api/v1/auth/tg_link.py

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

* docs(services): Fix logging and doc string errors

---------

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

* Feature/docker security improvements (#25)

* feat(docker): Isolate services by separating docker networks

* feat(docker): Add a system user app. Remove buffering and .pyc, __pycache__ files.

* feat(docker): Remove root privileges. Add cap_drop to disable root privileges. Enable write access to the /tmp folder.

* feat(logger): Remove logging to a file

* feat(docker): Write a user creation command in the api container and transfer the user change to the bot container

* docs: Correct syntax errors

---------

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* fix: Add && to the docker image build command (#27)

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* Feature/heartbit endpoint (#28)

* feat: Add a health endpoint to check if the API is online

* feat(docker): Add cleaning of outdated Docker images

* fix: Change your HealthCheck internet connection to avoid being blocked by RateLimiting

---------

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* feat: Bring the architecture to a clean archeticture. In the structur… (#29)

* feat: Bring the architecture to a clean archeticture. In the structure, repeat the project structure for easier navigation. Separate the models into different files.

* fix(models): Fix circular import

* fix(models): Fix circular import

* fix(models): correct error texts in models

---------

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* Fix/alembic migrations (#30)

* fix: Delete alembic.ini

* chore: add alembic.ini into .gitignore

* chore: update alembic scheme

* fix: Remove the backup key from config.py

* fix: Fix the SECRET_KEY test environment variable

* fix(auth): Fixing a missing SECRET_KEY error in .env

* fix(tests): Fix E401 [*] Multiple imports on one line

* feat(config): Add a check for the absence of DATABSE_URL in .env

* Add a database engine to lifespan's fastapi

* refactor: Move session factory to lifespan

---------

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* fix(migrations): Add alembic.ini file (#31)

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>

* refactor: refactor: simplify ban uniqueness constraint and database session handling

* feat(tasks): add background task for revoking expired bans

* chore(migrations): Upate migration scheme

* chore: update alembic scheme

---------

Co-authored-by: Squ1reX <maksimhripinkov658@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants