feat: add versioned backend scoring workflow
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user