This repository has no description
622 B
24 lines
1import {
2 pgTable,
3 text,
4 timestamp,
5 primaryKey,
6 index,
7} from 'drizzle-orm/pg-core';
8
9export const follows = pgTable(
10 'follows',
11 {
12 followerId: text('follower_id').notNull(),
13 targetId: text('target_id').notNull(),
14 targetType: text('target_type').notNull(),
15 createdAt: timestamp('created_at').notNull().defaultNow(),
16 },
17 (table) => ({
18 pk: primaryKey({
19 columns: [table.followerId, table.targetId, table.targetType],
20 }),
21 followerIdx: index('idx_follows_follower').on(table.followerId),
22 targetIdx: index('idx_follows_target').on(table.targetId, table.targetType),
23 }),
24);