Files
ZyyandCodex 525f3d51c1 refactor(store): consolidate unreleased scheduling migration
Fold smart scheduling settings into migration 0019 while preserving all released migrations through 0018. Update the checksum manifest and upgrade test.

Development databases that applied the previous 0019 or 0020 cannot upgrade in place because the migration history differs.

Co-authored-by: Codex <noreply@openai.com>
2026-09-26 21:59:05 +08:00

20 lines
1.1 KiB
SQL

-- 归属与稳定资源键属于宿主;升级沿用实例,删除实例只解除归属,不删除业务资源。
create table plugin_group_resources (
instance_id uuid not null references plugin_instances(id) on delete cascade,
resource_key text not null check (resource_key ~ '^[a-z0-9][a-z0-9_.-]{0,63}$'),
group_id text not null unique references account_groups(id) on delete cascade,
primary key (instance_id, resource_key)
);
create table plugin_key_resources (
instance_id uuid not null references plugin_instances(id) on delete cascade,
resource_key text not null check (resource_key ~ '^[a-z0-9][a-z0-9_.-]{0,63}$'),
key_id text not null unique references client_api_keys(id) on delete cascade,
primary key (instance_id, resource_key)
);
-- 保留默认调度行为;评分系数与回切偏好随运行设置原子发布。
alter table runtime_settings add column smart_scheduling_json jsonb not null default
'{"loadWeight":1.0,"quotaWeight":0.8,"healthWeight":1.0,"latencyWeight":0.5,"resetWeight":0.0,"queueWeight":0.0,"preferHigherWeight":false}'::jsonb
check (jsonb_typeof(smart_scheduling_json) = 'object');