From c00582da7c101160a0b2288f70cd7e5eea98e8a4 Mon Sep 17 00:00:00 2001 From: MS-01-Codex <3647348c-0c07-48e0-8938-fb9280321c5f@agents.multica.local> Date: Tue, 18 Aug 2026 18:18:45 +0800 Subject: [PATCH] fix: register m0004 add_mentor_note migration Co-authored-by: multica-agent --- backend/database/migrations/__init__.py | 8 ++++++- .../database/migrations/m0004_mentor_notes.py | 24 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 backend/database/migrations/m0004_mentor_notes.py diff --git a/backend/database/migrations/__init__.py b/backend/database/migrations/__init__.py index b06796d..694558f 100644 --- a/backend/database/migrations/__init__.py +++ b/backend/database/migrations/__init__.py @@ -1,8 +1,14 @@ from .m0001_adopt_legacy import MIGRATION as M0001_ADOPT_LEGACY from .m0002_job_runs import MIGRATION as M0002_JOB_RUNS 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 -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"] diff --git a/backend/database/migrations/m0004_mentor_notes.py b/backend/database/migrations/m0004_mentor_notes.py new file mode 100644 index 0000000..3433efa --- /dev/null +++ b/backend/database/migrations/m0004_mentor_notes.py @@ -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", +)