fix: register m0004 add_mentor_note migration
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
co-authored by
multica-agent
parent
e0cba74f8e
commit
0fba71f62c
@@ -1,8 +1,14 @@
|
|||||||
from .m0001_adopt_legacy import MIGRATION as M0001_ADOPT_LEGACY
|
from .m0001_adopt_legacy import MIGRATION as M0001_ADOPT_LEGACY
|
||||||
from .m0002_job_runs import MIGRATION as M0002_JOB_RUNS
|
from .m0002_job_runs import MIGRATION as M0002_JOB_RUNS
|
||||||
from .m0003_llm_audit import MIGRATION as M0003_LLM_AUDIT
|
from .m0003_llm_audit import MIGRATION as M0003_LLM_AUDIT
|
||||||
|
from .m0004_mentor_notes import MIGRATION as M0004_MENTOR_NOTES
|
||||||
from .runner import Migration, MigrationError, MigrationRunner
|
from .runner import Migration, MigrationError, MigrationRunner
|
||||||
|
|
||||||
MIGRATIONS = (M0001_ADOPT_LEGACY, M0002_JOB_RUNS, M0003_LLM_AUDIT)
|
MIGRATIONS = (
|
||||||
|
M0001_ADOPT_LEGACY,
|
||||||
|
M0002_JOB_RUNS,
|
||||||
|
M0003_LLM_AUDIT,
|
||||||
|
M0004_MENTOR_NOTES,
|
||||||
|
)
|
||||||
|
|
||||||
__all__ = ["MIGRATIONS", "Migration", "MigrationError", "MigrationRunner"]
|
__all__ = ["MIGRATIONS", "Migration", "MigrationError", "MigrationRunner"]
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
from backend.database.migrations.runner import Migration
|
||||||
|
|
||||||
|
|
||||||
|
def add_mentor_note(connection: sqlite3.Connection) -> None:
|
||||||
|
columns = {
|
||||||
|
str(row["name"])
|
||||||
|
for row in connection.execute("PRAGMA table_info(mentor_preferences)")
|
||||||
|
}
|
||||||
|
if "note" not in columns:
|
||||||
|
connection.execute(
|
||||||
|
"ALTER TABLE mentor_preferences ADD COLUMN note TEXT NOT NULL DEFAULT ''"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
MIGRATION = Migration(
|
||||||
|
version="0004",
|
||||||
|
name="add_mentor_note",
|
||||||
|
action=add_mentor_note,
|
||||||
|
signature="mentor-preferences-note:v1:note",
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user