Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
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.tsBlame87 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
06d5ffeClaude23export const sessions = pgTable("sessions", {
24 id: uuid("id").primaryKey().defaultRandom(),
25 userId: uuid("user_id")
26 .notNull()
27 .references(() => users.id, { onDelete: "cascade" }),
28 token: text("token").notNull().unique(),
29 expiresAt: timestamp("expires_at").notNull(),
30 createdAt: timestamp("created_at").defaultNow().notNull(),
31});
32
fc1817aClaude33export const repositories = pgTable(
34 "repositories",
35 {
36 id: uuid("id").primaryKey().defaultRandom(),
37 name: text("name").notNull(),
38 ownerId: uuid("owner_id")
39 .notNull()
40 .references(() => users.id),
41 description: text("description"),
42 isPrivate: boolean("is_private").default(false).notNull(),
43 defaultBranch: text("default_branch").default("main").notNull(),
44 diskPath: text("disk_path").notNull(),
45 createdAt: timestamp("created_at").defaultNow().notNull(),
46 updatedAt: timestamp("updated_at").defaultNow().notNull(),
47 pushedAt: timestamp("pushed_at"),
48 starCount: integer("star_count").default(0).notNull(),
49 forkCount: integer("fork_count").default(0).notNull(),
50 },
51 (table) => [uniqueIndex("repos_owner_name").on(table.ownerId, table.name)]
52);
53
06d5ffeClaude54export const stars = pgTable(
55 "stars",
56 {
57 id: uuid("id").primaryKey().defaultRandom(),
58 userId: uuid("user_id")
59 .notNull()
60 .references(() => users.id, { onDelete: "cascade" }),
61 repositoryId: uuid("repository_id")
62 .notNull()
63 .references(() => repositories.id, { onDelete: "cascade" }),
64 createdAt: timestamp("created_at").defaultNow().notNull(),
65 },
66 (table) => [uniqueIndex("stars_user_repo").on(table.userId, table.repositoryId)]
67);
68
fc1817aClaude69export const sshKeys = pgTable("ssh_keys", {
70 id: uuid("id").primaryKey().defaultRandom(),
71 userId: uuid("user_id")
72 .notNull()
06d5ffeClaude73 .references(() => users.id, { onDelete: "cascade" }),
fc1817aClaude74 title: text("title").notNull(),
75 fingerprint: text("fingerprint").notNull(),
76 publicKey: text("public_key").notNull(),
77 lastUsedAt: timestamp("last_used_at"),
78 createdAt: timestamp("created_at").defaultNow().notNull(),
79});
80
81export type User = typeof users.$inferSelect;
82export type NewUser = typeof users.$inferInsert;
83export type Repository = typeof repositories.$inferSelect;
84export type NewRepository = typeof repositories.$inferInsert;
06d5ffeClaude85export type Session = typeof sessions.$inferSelect;
86export type Star = typeof stars.$inferSelect;
87export type SshKey = typeof sshKeys.$inferSelect;