feat: add versioned backend scoring workflow

This commit is contained in:
2026-09-25 11:11:18 +08:00
parent 146d5566cf
commit eece55d08d
20 changed files with 2063 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
from alembic import context
from sqlalchemy import engine_from_config, pool
from wisegrade.config import get_settings
from wisegrade.db import Base
from wisegrade import models # noqa: F401
config = context.config
config.set_main_option("sqlalchemy.url", get_settings().database_url.replace("%", "%%"))
target_metadata = Base.metadata
def run_migrations_online():
connectable = engine_from_config(config.get_section(config.config_ini_section), prefix="sqlalchemy.", poolclass=pool.NullPool)
with connectable.connect() as connection:
if connection.dialect.name == "postgresql":
connection.exec_driver_sql("CREATE EXTENSION IF NOT EXISTS vector")
connection.commit()
context.configure(connection=connection, target_metadata=target_metadata)
with context.begin_transaction():
context.run_migrations()
run_migrations_online()