export const matches = pgTable(
'matches',
{
id: uuid('id').primaryKey().defaultRandom(),
userId: uuid('userId')
.references(() => users.id)
.notNull(),
swipedUserId: uuid('swiped_user_id')
.references(() => users.id)
.notNull(),
type: swipeTypeEnum('type').notNull().default('normal'),
createdAt: timestamp('created_at').notNull().defaultNow(),
updatedAt: timestamp('updated_at').notNull().defaultNow(),
deletedAt: timestamp('deleted_at')
},
(table) => ({
uniqueUserIdSwipedUserId: unique().on(table.userId, table.swipedUserId),
userIdIdx: index('user_id_idx').on(table.userId),
swipedUserIdIdx: index('swiped_user_id_idx').on(table.swipedUserId)
})
)
export const matches = pgTable(
'matches',
{
id: uuid('id').primaryKey().defaultRandom(),
userId: uuid('userId')
.references(() => users.id)
.notNull(),
swipedUserId: uuid('swiped_user_id')
.references(() => users.id)
.notNull(),
type: swipeTypeEnum('type').notNull().default('normal'),
createdAt: timestamp('created_at').notNull().defaultNow(),
updatedAt: timestamp('updated_at').notNull().defaultNow(),
deletedAt: timestamp('deleted_at')
},
(table) => ({
uniqueUserIdSwipedUserId: unique().on(table.userId, table.swipedUserId),
userIdIdx: index('user_id_idx').on(table.userId),
swipedUserIdIdx: index('swiped_user_id_idx').on(table.swipedUserId)
})
)