feat(builtin-models): add managed_by column to models table
Introduce a `managed_by` varchar column on `models` so future declarative
loaders can claim ownership of a subset of rows without disturbing entries
created via the UI/API or seeded by hand-written SQL.
- versioned/000052_models_managed_by.{up,down}.sql add the column with a
default of '' and a partial index on non-empty values to keep startup
reconciliation cheap.
- sqlite/000000_init.up.sql is updated in place (the Lite init migration
is a single file per project convention) so fresh SQLite databases get
the column from the start.
- Model.ManagedBy mirrors the column. Existing rows default to '' which
the YAML loader treats as "manually managed, never touch".
Schema half of the YAML-driven built-in-model lifecycle work that follows
up on #1453; the reconciler that uses the column lands in the next commit.
This commit is contained in:
@@ -37,6 +37,7 @@ CREATE TABLE IF NOT EXISTS models (
|
||||
parameters TEXT NOT NULL,
|
||||
is_default BOOLEAN NOT NULL DEFAULT 0,
|
||||
is_builtin BOOLEAN NOT NULL DEFAULT 0,
|
||||
managed_by VARCHAR(32) NOT NULL DEFAULT '',
|
||||
status VARCHAR(50) NOT NULL DEFAULT 'active',
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
@@ -46,6 +47,7 @@ CREATE TABLE IF NOT EXISTS models (
|
||||
CREATE INDEX IF NOT EXISTS idx_models_type ON models(type);
|
||||
CREATE INDEX IF NOT EXISTS idx_models_source ON models(source);
|
||||
CREATE INDEX IF NOT EXISTS idx_models_is_builtin ON models(is_builtin);
|
||||
CREATE INDEX IF NOT EXISTS idx_models_managed_by ON models(managed_by);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS knowledge_bases (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
|
||||
Reference in New Issue
Block a user