feat: add boards and tasks management endpoints

This commit is contained in:
Abhimanyu Saharan
2026-02-04 02:28:51 +05:30
parent 23faa0865b
commit 1abc8f68f3
170 changed files with 6860 additions and 10706 deletions

View File

@@ -1,36 +1,51 @@
from __future__ import annotations
import sys
from logging.config import fileConfig
from pathlib import Path
from sqlalchemy import engine_from_config, pool
from sqlmodel import SQLModel
from alembic import context
# Import models to register tables in metadata
from app import models # noqa: F401
from app.core.config import settings
PROJECT_ROOT = Path(__file__).resolve().parents[1]
if str(PROJECT_ROOT) not in sys.path:
sys.path.append(str(PROJECT_ROOT))
from app import models # noqa: E402,F401
from app.core.config import settings # noqa: E402
config = context.config
if config.config_file_name is not None:
if config.config_file_name is not None and config.attributes.get("configure_logger", True):
fileConfig(config.config_file_name)
target_metadata = SQLModel.metadata
def _normalize_database_url(database_url: str) -> str:
if "://" not in database_url:
return database_url
scheme, rest = database_url.split("://", 1)
if scheme == "postgresql":
return f"postgresql+psycopg://{rest}"
return database_url
def get_url() -> str:
return settings.database_url
return _normalize_database_url(settings.database_url)
config.set_main_option("sqlalchemy.url", get_url())
def run_migrations_offline() -> None:
url = get_url()
context.configure(
url=url,
url=get_url(),
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
compare_type=True,
)
with context.begin_transaction():
@@ -48,7 +63,11 @@ def run_migrations_online() -> None:
)
with connectable.connect() as connection:
context.configure(connection=connection, target_metadata=target_metadata)
context.configure(
connection=connection,
target_metadata=target_metadata,
compare_type=True,
)
with context.begin_transaction():
context.run_migrations()