28 lines
586 B
TypeScript
28 lines
586 B
TypeScript
import {
|
|
integer,
|
|
jsonb,
|
|
pgTable,
|
|
serial,
|
|
timestamp,
|
|
uniqueIndex,
|
|
varchar,
|
|
} from "drizzle-orm/pg-core";
|
|
|
|
export const cardCache = pgTable(
|
|
"card_cache",
|
|
{
|
|
id: serial("id").primaryKey(),
|
|
movieId: integer("movie_id").notNull(),
|
|
cardType: varchar("card_type", { length: 50 }).notNull(),
|
|
payload: jsonb("payload").notNull(),
|
|
createdAt: timestamp("created_at", { withTimezone: true })
|
|
.defaultNow()
|
|
.notNull(),
|
|
},
|
|
(table) => [
|
|
uniqueIndex("card_cache_movie_card_unique").on(
|
|
table.movieId,
|
|
table.cardType,
|
|
),
|
|
],
|
|
); |