[+] improve alembic

This commit is contained in:
Siarhei Siniak 2025-07-03 11:18:35 +03:00
parent eb2d630dd0
commit 2dec1e33c2
3 changed files with 8 additions and 2 deletions

@ -1,4 +1,5 @@
ENV_PATH ?= .venv
PYTHON_PATH = $(ENV_PATH)/bin/python3
PYTHON_VERSION ?= 3.10
UV_ARGS ?= --offline
DOCKER ?= podman
@ -33,7 +34,7 @@ venv:
pyright:
$(ENV_PATH)/bin/python3 -m pyright \
-p pyproject.toml \
-v $(ENV_PATH)
--pythonpath $(PYTHON_PATH)
compose_env:

@ -33,6 +33,7 @@ build-backend = 'setuptools.build_meta'
[tool.alembic]
script_location = 'python/online/fxreader/pr34/test_task_2025_06_30_v1/tickers/alembic'
prepend_sys_path = ['python']
[tool.ruff]
line-length = 160

@ -27,6 +27,8 @@ target_metadata = None
def run_migrations_offline() -> None:
from online.fxreader.pr34.test_task_2025_06_30_v1.tickers.settings import Settings
"""Run migrations in 'offline' mode.
This configures the context with just a URL
@ -38,7 +40,9 @@ def run_migrations_offline() -> None:
script output.
"""
url = config.get_main_option("sqlalchemy.url")
# url = config.get_main_option("sqlalchemy.url")
url = Settings.singleton().db_url
context.configure(
url=url,
target_metadata=target_metadata,