| 1 | import { createId } from "@paralleldrive/cuid2"; |
| 2 | import { pgTable, text |
| 3 | import { user } |
| 4 | import { repository } |
| 5 | |
| 6 | export const stars = |
| 7 | "stars", |
| 8 | { |
| 9 | id: text() |
| 10 | .primaryKey() |
| 11 | .unique() |
| 12 | .$defaultFn(() => |
| 13 | .notNull(), |
| 14 | userId: text() |
| 15 | .notNull() |
| 16 | .references(() => |
| 17 | repositoryId: text() |
| 18 | .notNull() |
| 19 | .references(() => |
| 20 | |
| 21 | createdAt: timestamp({ |
| 22 | updatedAt: timestamp({ |
| 23 | .notNull() |
| 24 | .defaultNow() |
| 25 | .$onUpdateFn(() => |
| 26 | }, |
| 27 | (t) => |
| 28 | ); |