码桶

发现社区成员的开源项目

早晚圈 / meeting 公开
main
meeting/src/db/schema.ts
schema.ts1.2 KB
import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
import { pgTable, text as pgText, timestamp as pgTimestamp } from 'drizzle-orm/pg-core';

// Cloudflare D1 驱动使用的 SQLite Schema
export const meetingsD1 = sqliteTable('meetings', {
  id: text('id').primaryKey(),
  slug: text('slug').notNull().unique(),
  meetingId: text('meeting_id'),
  dmCode: text('dm_code'),
  dedupHash: text('dedup_hash').notNull().unique(),
  topic: text('topic'),
  rawText: text('raw_text').notNull(),
  userSessionId: text('user_session_id').notNull(),
  createdAt: integer('created_at', { mode: 'timestamp_ms' }).notNull(),
  expiresAt: integer('expires_at', { mode: 'timestamp_ms' }).notNull(),
});

// VPS 模式使用的 PostgreSQL 17 Schema
export const meetingsPg = pgTable('meetings', {
  id: pgText('id').primaryKey(),
  slug: pgText('slug').notNull().unique(),
  meetingId: pgText('meeting_id'),
  dmCode: pgText('dm_code'),
  dedupHash: pgText('dedup_hash').notNull().unique(),
  topic: pgText('topic'),
  rawText: pgText('raw_text').notNull(),
  userSessionId: pgText('user_session_id').notNull(),
  createdAt: pgTimestamp('created_at').notNull(),
  expiresAt: pgTimestamp('expires_at').notNull(),
});