27 lines
854 B
TypeScript
27 lines
854 B
TypeScript
import { pgTable, serial, text, integer, timestamp, boolean } from 'drizzle-orm/pg-core';
|
|
|
|
export const domains = pgTable('domains', {
|
|
id: serial('id').primaryKey(),
|
|
bucket: text('bucket').unique().notNull(),
|
|
domain: text('domain').notNull(),
|
|
});
|
|
|
|
export const emails = pgTable('emails', {
|
|
id: serial('id').primaryKey(),
|
|
domainId: integer('domain_id').references(() => domains.id).notNull(),
|
|
s3Key: text('s3_key').unique().notNull(),
|
|
from: text('from'),
|
|
to: text('to').array(),
|
|
cc: text('cc').array(),
|
|
bcc: text('bcc').array(),
|
|
subject: text('subject'),
|
|
html: text('html'),
|
|
raw: text('raw'),
|
|
processed: boolean('processed').default(false),
|
|
date: timestamp('date'),
|
|
// Neue Metadaten
|
|
processedAt: timestamp('processed_at'),
|
|
processedBy: text('processed_by'),
|
|
queuedTo: text('queued_to'),
|
|
status: text('status'),
|
|
}); |