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 {
3 pgTable,
4 text,
5 timestamp,
6 uniqueIndex,
7 integer,
8} from "drizzle-orm/pg-core";
9import sandboxes from "./sandboxes";
10import services from "./services";
11
12const sandboxPorts = pgTable(
13 "sandbox_ports",
14 {
15 id: text("id").primaryKey().default(sql`xata_id()`),
16 sandboxId: text("sandbox_id")
17 .notNull()
18 .references(() => sandboxes.id, { onDelete: "cascade" }),
19 exposedPort: integer("exposed_port").notNull(),
20 previewUrl: text("preview_url"),
21 description: text("description"),
22 serviceId: text("service_id").references(() => services.id),
23 createdAt: timestamp("created_at").defaultNow().notNull(),
24 updatedAt: timestamp("updated_at").defaultNow().notNull(),
25 },
26 (t) => [uniqueIndex("unique_sandbox_port").on(t.sandboxId, t.exposedPort)],
27);
28
29export type SelectSandboxPort = InferSelectModel<typeof sandboxPorts>;
30export type InsertSandboxPort = InferInsertModel<typeof sandboxPorts>;
31
32export default sandboxPorts;