-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sql
More file actions
58 lines (51 loc) · 2.82 KB
/
Copy pathinit.sql
File metadata and controls
58 lines (51 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
-- one-codingplan (ocp) database init script
-- Generated from ocp.db schema
CREATE TABLE IF NOT EXISTS `upstreams` (
`id` integer PRIMARY KEY AUTOINCREMENT,
`created_at` datetime,
`updated_at` datetime,
`name` text NOT NULL,
`base_url` text NOT NULL,
`api_key_enc` blob,
`enabled` numeric NOT NULL DEFAULT true,
`model_override` text NOT NULL DEFAULT "",
`protocol` text NOT NULL DEFAULT 'both',
`passthrough_extensions` numeric NOT NULL DEFAULT false
);
CREATE UNIQUE INDEX IF NOT EXISTS `idx_upstreams_name` ON `upstreams`(`name`);
-- Upstream seed data (api_key_enc left null — set real keys via portal or PATCH /api/upstreams/:id)
INSERT OR IGNORE INTO `upstreams` (`name`, `base_url`, `api_key_enc`, `enabled`, `model_override`, `protocol`, `created_at`, `updated_at`) VALUES
('minimax', 'https://api.minimaxi.com', NULL, 0, 'MiniMax-M2.5', 'both', datetime('now'), datetime('now')),
('kimi', 'https://api.kimi.com/coding', NULL, 0, '', 'both', datetime('now'), datetime('now')),
('qwen', 'https://dashscope.aliyuncs.com', NULL, 0, '', 'openai', datetime('now'), datetime('now')),
('mimo', 'https://token-plan-cn.xiaomimimo.com', NULL, 0, 'mimo-v2-pro', 'both', datetime('now'), datetime('now')),
('deepseek','https://api.deepseek.com', NULL, 1, 'deepseek-chat','openai', datetime('now'), datetime('now'))
;
CREATE TABLE IF NOT EXISTS `access_keys` (
`id` text PRIMARY KEY,
`created_at` datetime,
`updated_at` datetime,
`token` text NOT NULL,
`enabled` numeric NOT NULL DEFAULT true,
`name` text NOT NULL DEFAULT "",
`token_budget` integer NOT NULL DEFAULT 0,
`allowed_upstreams` text NOT NULL DEFAULT "",
`expires_at` datetime,
`rate_limit_per_minute` integer NOT NULL DEFAULT 0,
`rate_limit_per_day` integer NOT NULL DEFAULT 0
);
CREATE UNIQUE INDEX IF NOT EXISTS `idx_access_keys_token` ON `access_keys`(`token`);
CREATE TABLE IF NOT EXISTS `usage_records` (
`id` integer PRIMARY KEY AUTOINCREMENT,
`created_at` datetime,
`key_id` text NOT NULL,
`upstream_id` integer NOT NULL,
`upstream_name` text NOT NULL DEFAULT "",
`input_tokens` integer,
`output_tokens` integer,
`latency_ms` integer,
`success` numeric
);
CREATE INDEX IF NOT EXISTS `idx_usage_records_key_id` ON `usage_records`(`key_id`);
CREATE INDEX IF NOT EXISTS `idx_usage_records_upstream_id` ON `usage_records`(`upstream_id`);
CREATE INDEX IF NOT EXISTS `idx_usage_records_created_at` ON `usage_records`(`created_at`);