| import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core'; |
|
|
| |
| export const prompts = sqliteTable('prompts', { |
| id: text('id').primaryKey(), |
| title: text('title').notNull(), |
| contentImage: text('content_image').default(''), |
| contentVideo: text('content_video').default(''), |
| translationImage: text('translation_image'), |
| translationVideo: text('translation_video'), |
| tags: text('tags').default('[]'), |
| sourceUrl: text('source_url'), |
| isFavorite: integer('is_favorite', { mode: 'boolean' }).default(false), |
| createdAt: integer('created_at').notNull(), |
| updatedAt: integer('updated_at').notNull(), |
| }); |
|
|
| |
| export const images = sqliteTable('images', { |
| id: text('id').primaryKey(), |
| promptId: text('prompt_id').notNull(), |
| b64: text('b64').notNull(), |
| model: text('model').notNull(), |
| size: text('size').notNull(), |
| quality: text('quality').notNull(), |
| generationDuration: integer('generation_duration').notNull(), |
| promptUsed: text('prompt_used').notNull(), |
| createdAt: integer('created_at').notNull(), |
| }); |
|
|
| |
| |
| export const settings = sqliteTable('settings', { |
| id: text('id').primaryKey().default('default'), |
| openaiBaseUrl: text('openai_base_url').default('https://api.openai.com/v1'), |
| openaiApiKey: text('openai_api_key').default(''), |
| imageModel: text('image_model').default('gpt-image-2'), |
| |
| defaultSize: text('default_size').default('1024x1024'), |
| |
| customSizes: text('custom_sizes').default('[]'), |
| translateModel: text('translate_model').default('gpt-4o-mini'), |
| |
| accessPassword: text('access_password').default(''), |
| |
| jobPollInterval: integer('job_poll_interval').default(3000), |
| updatedAt: integer('updated_at').notNull(), |
| }); |
|
|
| export type Prompt = typeof prompts.$inferSelect; |
| export type NewPrompt = typeof prompts.$inferInsert; |
| export type Image = typeof images.$inferSelect; |
| export type Settings = typeof settings.$inferSelect; |
|
|