first commit
This commit is contained in:
27
src/database/schema/social.schema.ts
Normal file
27
src/database/schema/social.schema.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
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(),
|
||||
});
|
||||
Reference in New Issue
Block a user