36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { mysqlTable, varchar, text, mysqlEnum, int, datetime } from 'drizzle-orm/mysql-core';
|
|
|
|
export const postStatusEnum = mysqlEnum('status', [
|
|
'inbox',
|
|
'editing',
|
|
'ready_for_publish',
|
|
'published',
|
|
'archived',
|
|
]);
|
|
|
|
export const posts = mysqlTable('posts', {
|
|
id: varchar('id', { length: 36 }).primaryKey(),
|
|
title: varchar('title', { length: 255 }),
|
|
contentHtml: text('content_html').notNull(),
|
|
tagsText: text('tags_text'),
|
|
featureImage: text('feature_image'),
|
|
canonicalUrl: text('canonical_url'),
|
|
status: postStatusEnum.notNull().default('editing'),
|
|
ghostPostId: varchar('ghost_post_id', { length: 64 }),
|
|
ghostUrl: text('ghost_url'),
|
|
version: int('version').notNull().default(1),
|
|
createdAt: datetime('created_at', { fsp: 3 }).notNull(),
|
|
updatedAt: datetime('updated_at', { fsp: 3 }).notNull(),
|
|
});
|
|
|
|
export const audioClips = mysqlTable('audio_clips', {
|
|
id: varchar('id', { length: 36 }).primaryKey(),
|
|
postId: varchar('post_id', { length: 36 }).notNull(),
|
|
bucket: varchar('bucket', { length: 128 }).notNull(),
|
|
key: text('object_key').notNull(),
|
|
mime: varchar('mime', { length: 64 }).notNull(),
|
|
transcript: text('transcript'),
|
|
durationMs: int('duration_ms'),
|
|
createdAt: datetime('created_at', { fsp: 3 }).notNull(),
|
|
});
|