-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.ts
More file actions
38 lines (34 loc) · 1009 Bytes
/
schema.ts
File metadata and controls
38 lines (34 loc) · 1009 Bytes
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 {
int,
index,
text,
singlestoreTableCreator,
bigint,
} from "drizzle-orm/singlestore-core";
const createTable = singlestoreTableCreator((name) => `drive_tutorial_${name}`);
export const files_table = createTable(
"files",
{
id: bigint("id", { mode: "number", unsigned: true })
.primaryKey()
.autoincrement(),
name: text("name").notNull(),
url: text("url").notNull(),
size: int("size").notNull(),
parent: bigint("parent", { mode: "number", unsigned: true }),
},
(table) => [index("parent_index").on(table.parent)],
);
export const folders_table = createTable(
"folders",
{
id: bigint("id", { mode: "number", unsigned: true })
.primaryKey()
.autoincrement(),
name: text("name").notNull(),
parent: bigint("parent", { mode: "number", unsigned: true }),
},
(table) => [index("parent_index").on(table.parent)],
);
export type File = typeof files_table.$inferSelect;
export type Folder = typeof folders_table.$inferSelect;