28 lines
985 B
TypeScript
28 lines
985 B
TypeScript
import { pgEnum, pgTable, timestamp, uuid } from 'drizzle-orm/pg-core';
|
|
import { user } from './user.schema';
|
|
|
|
export const likeTypeEnum = pgEnum('like_type', ['like', 'dislike']);
|
|
|
|
export const like = pgTable('like', {
|
|
id: uuid('id').primaryKey().defaultRandom(),
|
|
sourceUser: uuid('source_user')
|
|
.notNull()
|
|
.references(() => user.id, { onDelete: 'cascade' }),
|
|
targetUser: uuid('target_user')
|
|
.notNull()
|
|
.references(() => user.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(),
|
|
user1Id: uuid('user1_id')
|
|
.notNull()
|
|
.references(() => user.id, { onDelete: 'cascade' }),
|
|
user2Id: uuid('user2_id')
|
|
.notNull()
|
|
.references(() => user.id, { onDelete: 'cascade' }),
|
|
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
|
});
|