Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesPull RequestsActionsSecurityInsightsSettings
✨ AI
More
Blame · Line-by-line history

schema.ts

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

schema.tsBlame59 lines · 1 contributor
fc1817aClaude1import {
2 pgTable,
3 text,
4 timestamp,
5 uuid,
6 boolean,
7 integer,
8 uniqueIndex,
9} from "drizzle-orm/pg-core";
10
11export const users = pgTable("users", {
12 id: uuid("id").primaryKey().defaultRandom(),
13 username: text("username").notNull().unique(),
14 email: text("email").notNull().unique(),
15 displayName: text("display_name"),
16 passwordHash: text("password_hash").notNull(),
17 avatarUrl: text("avatar_url"),
18 bio: text("bio"),
19 createdAt: timestamp("created_at").defaultNow().notNull(),
20 updatedAt: timestamp("updated_at").defaultNow().notNull(),
21});
22
23export const repositories = pgTable(
24 "repositories",
25 {
26 id: uuid("id").primaryKey().defaultRandom(),
27 name: text("name").notNull(),
28 ownerId: uuid("owner_id")
29 .notNull()
30 .references(() => users.id),
31 description: text("description"),
32 isPrivate: boolean("is_private").default(false).notNull(),
33 defaultBranch: text("default_branch").default("main").notNull(),
34 diskPath: text("disk_path").notNull(),
35 createdAt: timestamp("created_at").defaultNow().notNull(),
36 updatedAt: timestamp("updated_at").defaultNow().notNull(),
37 pushedAt: timestamp("pushed_at"),
38 starCount: integer("star_count").default(0).notNull(),
39 forkCount: integer("fork_count").default(0).notNull(),
40 },
41 (table) => [uniqueIndex("repos_owner_name").on(table.ownerId, table.name)]
42);
43
44export const sshKeys = pgTable("ssh_keys", {
45 id: uuid("id").primaryKey().defaultRandom(),
46 userId: uuid("user_id")
47 .notNull()
48 .references(() => users.id),
49 title: text("title").notNull(),
50 fingerprint: text("fingerprint").notNull(),
51 publicKey: text("public_key").notNull(),
52 lastUsedAt: timestamp("last_used_at"),
53 createdAt: timestamp("created_at").defaultNow().notNull(),
54});
55
56export type User = typeof users.$inferSelect;
57export type NewUser = typeof users.$inferInsert;
58export type Repository = typeof repositories.$inferSelect;
59export type NewRepository = typeof repositories.$inferInsert;