-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathschema.ts
More file actions
38 lines (36 loc) · 1.35 KB
/
schema.ts
File metadata and controls
38 lines (36 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { sqliteTable, text, integer, uniqueIndex } from "drizzle-orm/sqlite-core";
export const visitorLogs = sqliteTable(
"visitor_logs",
{
id: integer("id").primaryKey({ autoIncrement: true }),
username: text("username").notNull(),
ip_hash: text("ip_hash").notNull(),
visit_date: text("visit_date").notNull(), // YYYY-MM-DD
created_at: integer("created_at"),
},
(table) => {
return {
uqVisitorLog: uniqueIndex("uq_visitor_log").on(
table.username,
table.ip_hash,
table.visit_date,
),
};
},
);
export const badges = sqliteTable("badges", {
username: text("username").primaryKey(),
visitors: integer("visitors").notNull().default(0),
repositories: integer("repositories"),
organization: integer("organization"),
languages: integer("languages"),
followers: integer("followers"),
total_stars: integer("total_stars"),
total_contributors: integer("total_contributors"),
total_commits: integer("total_commits"),
total_code_reviews: integer("total_code_reviews"),
total_issues: integer("total_issues"),
total_pull_requests: integer("total_pull_requests"),
total_joined_years: integer("total_joined_years"),
updated_at: integer("updated_at"),
});