the universal sandbox runtime for agents and humans.
pocketenv.io
sandbox
openclaw
agent
claude-code
vercel-sandbox
deno-sandbox
cloudflare-sandbox
atproto
sprites
daytona
1import { type InferInsertModel, type InferSelectModel, sql } from "drizzle-orm";
2import { pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
3import sandboxes from "./sandboxes";
4import files from "./files";
5
6const sandboxFiles = pgTable(
7 "sandbox_files",
8 {
9 id: text("id").primaryKey().default(sql`file_id()`),
10 sandboxId: text("sandbox_id")
11 .notNull()
12 .references(() => sandboxes.id, { onDelete: "cascade" }),
13 fileId: text("file_id")
14 .notNull()
15 .references(() => files.id),
16 path: text("path").notNull(),
17 createdAt: timestamp("created_at").defaultNow().notNull(),
18 updatedAt: timestamp("updated_at").defaultNow().notNull(),
19 },
20 (t) => [uniqueIndex("unique_sandbox_file_path").on(t.sandboxId, t.path)],
21);
22
23export type SelectSandboxFile = InferSelectModel<typeof sandboxFiles>;
24export type InsertSandboxFile = InferInsertModel<typeof sandboxFiles>;
25
26export default sandboxFiles;