-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathschema.sql
More file actions
53 lines (48 loc) · 1.89 KB
/
Copy pathschema.sql
File metadata and controls
53 lines (48 loc) · 1.89 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
CREATE TABLE IF NOT EXISTS workflows (
id TEXT PRIMARY KEY,
name TEXT NOT NULL DEFAULT 'Untitled Workflow',
nodes TEXT NOT NULL DEFAULT '[]',
edges TEXT NOT NULL DEFAULT '[]',
viewport TEXT NOT NULL DEFAULT '{"x":0,"y":0,"zoom":1}',
created_at TEXT NOT NULL DEFAULT (datetime('now')),
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
);
CREATE TABLE IF NOT EXISTS generations (
id TEXT PRIMARY KEY,
workflow_id TEXT NOT NULL DEFAULT '',
node_id TEXT NOT NULL,
prompt TEXT NOT NULL,
model TEXT NOT NULL,
image_url TEXT,
status TEXT NOT NULL DEFAULT 'pending',
error TEXT,
run_id TEXT,
-- USD billed by the provider for this generation, as reported upstream.
-- Stored in the provider's native unit; the UI converts to credits when the
-- app runs on Clawnify (see src/server/pricing.ts → resolveCostUnit).
cost_usd REAL,
created_at TEXT NOT NULL DEFAULT (datetime('now'))
);
CREATE INDEX IF NOT EXISTS idx_generations_workflow ON generations(workflow_id);
CREATE INDEX IF NOT EXISTS idx_generations_run ON generations(run_id);
CREATE TABLE IF NOT EXISTS workflow_runs (
id TEXT PRIMARY KEY,
workflow_id TEXT NOT NULL,
snapshot TEXT,
status TEXT NOT NULL DEFAULT 'pending',
created_at TEXT NOT NULL DEFAULT (datetime('now')),
completed_at TEXT
);
CREATE INDEX IF NOT EXISTS idx_workflow_runs_workflow ON workflow_runs(workflow_id);
-- Reusable style definitions ("lock your style once"). Referenced by style
-- nodes on the canvas and by Quick Generate; expanded into the prompt and
-- input images server-side at generation time.
CREATE TABLE IF NOT EXISTS style_presets (
id TEXT PRIMARY KEY,
name TEXT NOT NULL DEFAULT 'Untitled Style',
instruction TEXT NOT NULL DEFAULT '',
palette TEXT NOT NULL DEFAULT '[]',
reference_images TEXT NOT NULL DEFAULT '[]',
created_at TEXT NOT NULL DEFAULT (datetime('now')),
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
);