28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import { pgEnum, pgTable, timestamp, uuid } from 'drizzle-orm/pg-core';
|
|
import { profile } from './profile.schema';
|
|
|
|
export const likeTypeEnum = pgEnum('like_type', ['like', 'dislike']);
|
|
|
|
export const like = pgTable('like', {
|
|
id: uuid('id').primaryKey().defaultRandom(),
|
|
sourceProfileId: uuid('source_profile_id')
|
|
.notNull()
|
|
.references(() => profile.id, { onDelete: 'cascade' }),
|
|
targetProfileId: uuid('target_profile_id')
|
|
.notNull()
|
|
.references(() => profile.id, { onDelete: 'cascade' }),
|
|
type: likeTypeEnum('type').notNull(),
|
|
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
|
});
|
|
|
|
export const match = pgTable('match', {
|
|
id: uuid('id').primaryKey().defaultRandom(),
|
|
profile1Id: uuid('profile1_id')
|
|
.notNull()
|
|
.references(() => profile.id, { onDelete: 'cascade' }),
|
|
profile2Id: uuid('profile2_id')
|
|
.notNull()
|
|
.references(() => profile.id, { onDelete: 'cascade' }),
|
|
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
|
});
|