mirror of
https://gitbruv.vercel.app/api/git/bruv/gitbruv.git
synced 2025-12-20 23:24:09 +01:00
added
This commit is contained in:
parent
ba29d1ad56
commit
bbbf5f2a24
14 changed files with 1071 additions and 29 deletions
16
db/schema.ts
16
db/schema.ts
|
|
@ -1,4 +1,4 @@
|
|||
import { pgTable, text, timestamp, boolean, uuid, jsonb } from "drizzle-orm/pg-core";
|
||||
import { pgTable, text, timestamp, boolean, uuid, jsonb, primaryKey } from "drizzle-orm/pg-core";
|
||||
|
||||
export const users = pgTable("users", {
|
||||
id: text("id").primaryKey(),
|
||||
|
|
@ -76,3 +76,17 @@ export const repositories = pgTable("repositories", {
|
|||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
updatedAt: timestamp("updated_at").notNull().defaultNow(),
|
||||
});
|
||||
|
||||
export const stars = pgTable(
|
||||
"stars",
|
||||
{
|
||||
userId: text("user_id")
|
||||
.notNull()
|
||||
.references(() => users.id, { onDelete: "cascade" }),
|
||||
repositoryId: uuid("repository_id")
|
||||
.notNull()
|
||||
.references(() => repositories.id, { onDelete: "cascade" }),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
},
|
||||
(table) => [primaryKey({ columns: [table.userId, table.repositoryId] })]
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue