Changeset 0.22.2 (#96)
This commit is contained in:
24
server/database/migrations/sqlite/013_v0222_routing.sql
Normal file
24
server/database/migrations/sqlite/013_v0222_routing.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- Migration 013: v0.22.2 — Routing Policies (SQLite)
|
||||
|
||||
CREATE TABLE IF NOT EXISTS routing_policies (
|
||||
id TEXT PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
scope TEXT NOT NULL DEFAULT 'global'
|
||||
CHECK (scope IN ('global', 'team')),
|
||||
team_id TEXT REFERENCES teams(id) ON DELETE CASCADE,
|
||||
priority INTEGER NOT NULL DEFAULT 100,
|
||||
policy_type TEXT NOT NULL
|
||||
CHECK (policy_type IN ('provider_prefer', 'team_route', 'cost_limit', 'model_alias')),
|
||||
config TEXT NOT NULL DEFAULT '{}',
|
||||
is_active INTEGER NOT NULL DEFAULT 1,
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_routing_policies_active
|
||||
ON routing_policies(is_active, priority);
|
||||
CREATE INDEX IF NOT EXISTS idx_routing_policies_team
|
||||
ON routing_policies(team_id);
|
||||
|
||||
-- Add routing_decision column to usage_log
|
||||
ALTER TABLE usage_log ADD COLUMN routing_decision TEXT;
|
||||
Reference in New Issue
Block a user