File size: 1,218 Bytes
cfea436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
CREATE TABLE `prompts` (
  `id` text PRIMARY KEY NOT NULL,
  `title` text NOT NULL,
  `content_image` text DEFAULT '',
  `content_video` text DEFAULT '',
  `translation_image` text,
  `translation_video` text,
  `tags` text DEFAULT '[]',
  `source_url` text,
  `is_favorite` integer DEFAULT 0,
  `created_at` integer NOT NULL,
  `updated_at` integer NOT NULL
);

CREATE INDEX `idx_prompts_updated` ON `prompts`(`updated_at`);
CREATE INDEX `idx_prompts_favorite` ON `prompts`(`is_favorite`);

CREATE TABLE `images` (
  `id` text PRIMARY KEY NOT NULL,
  `prompt_id` text NOT NULL,
  `b64` text NOT NULL,
  `model` text NOT NULL,
  `size` text NOT NULL,
  `quality` text NOT NULL,
  `generation_duration` integer NOT NULL,
  `prompt_used` text NOT NULL,
  `created_at` integer NOT NULL
);

CREATE INDEX `idx_images_prompt` ON `images`(`prompt_id`);

CREATE TABLE `settings` (
  `id` text PRIMARY KEY NOT NULL DEFAULT 'default',
  `openai_base_url` text DEFAULT 'https://api.openai.com/v1',
  `openai_api_key` text DEFAULT '',
  `image_model` text DEFAULT 'gpt-image-2',
  `translate_model` text DEFAULT 'gpt-4o-mini',
  `updated_at` integer NOT NULL
);

INSERT INTO `settings` (`id`, `updated_at`) VALUES ('default', 0);