the universal sandbox runtime for agents and humans. pocketenv.io
sandbox openclaw agent claude-code vercel-sandbox deno-sandbox cloudflare-sandbox atproto sprites daytona
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add sandbox_ports table and schema

+1518
+31
apps/api/src/schema/sandbox-ports.ts
··· 1 + import { type InferInsertModel, type InferSelectModel, sql } from "drizzle-orm"; 2 + import { 3 + pgTable, 4 + text, 5 + timestamp, 6 + uniqueIndex, 7 + integer, 8 + } from "drizzle-orm/pg-core"; 9 + import sandboxes from "./sandboxes"; 10 + 11 + const sandboxPorts = pgTable( 12 + "sandbox_ports", 13 + { 14 + id: text("id") 15 + .primaryKey() 16 + .default(sql`xata_id()`), 17 + sandboxId: text("sandbox_id") 18 + .notNull() 19 + .references(() => sandboxes.id), 20 + exposedPort: integer("exposed_port").notNull(), 21 + previewUrl: text("preview_url"), 22 + createdAt: timestamp("created_at").defaultNow().notNull(), 23 + updatedAt: timestamp("updated_at").defaultNow().notNull(), 24 + }, 25 + (t) => [uniqueIndex("unique_sandbox_port").on(t.sandboxId, t.exposedPort)], 26 + ); 27 + 28 + export type SelectSandboxPort = InferSelectModel<typeof sandboxPorts>; 29 + export type InsertSandboxPort = InferInsertModel<typeof sandboxPorts>; 30 + 31 + export default sandboxPorts;
+11
apps/cf-sandbox/drizzle/0028_quiet_korvac.sql
··· 1 + CREATE TABLE "sandbox_ports" ( 2 + "id" text PRIMARY KEY DEFAULT xata_id() NOT NULL, 3 + "sandbox_id" text NOT NULL, 4 + "exposed_port" integer NOT NULL, 5 + "preview_url" text, 6 + "created_at" timestamp DEFAULT now() NOT NULL, 7 + "updated_at" timestamp DEFAULT now() NOT NULL 8 + ); 9 + --> statement-breakpoint 10 + ALTER TABLE "sandbox_ports" ADD CONSTRAINT "sandbox_ports_sandbox_id_sandboxes_id_fk" FOREIGN KEY ("sandbox_id") REFERENCES "public"."sandboxes"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint 11 + CREATE UNIQUE INDEX "unique_sandbox_port" ON "sandbox_ports" USING btree ("sandbox_id","exposed_port");
+1403
apps/cf-sandbox/drizzle/meta/0028_snapshot.json
··· 1 + { 2 + "id": "a4eff7f3-c689-4a08-9bd3-81888d89de31", 3 + "prevId": "024d2a4f-c8a8-4c1d-acaf-5cc7ea758c7a", 4 + "version": "7", 5 + "dialect": "postgresql", 6 + "tables": { 7 + "public.authorized_keys": { 8 + "name": "authorized_keys", 9 + "schema": "", 10 + "columns": { 11 + "id": { 12 + "name": "id", 13 + "type": "text", 14 + "primaryKey": true, 15 + "notNull": true, 16 + "default": "xata_id()" 17 + }, 18 + "sandbox_id": { 19 + "name": "sandbox_id", 20 + "type": "text", 21 + "primaryKey": false, 22 + "notNull": false 23 + }, 24 + "public_key": { 25 + "name": "public_key", 26 + "type": "text", 27 + "primaryKey": false, 28 + "notNull": true 29 + }, 30 + "created_at": { 31 + "name": "created_at", 32 + "type": "timestamp", 33 + "primaryKey": false, 34 + "notNull": true, 35 + "default": "now()" 36 + } 37 + }, 38 + "indexes": {}, 39 + "foreignKeys": { 40 + "authorized_keys_sandbox_id_sandboxes_id_fk": { 41 + "name": "authorized_keys_sandbox_id_sandboxes_id_fk", 42 + "tableFrom": "authorized_keys", 43 + "tableTo": "sandboxes", 44 + "columnsFrom": [ 45 + "sandbox_id" 46 + ], 47 + "columnsTo": [ 48 + "id" 49 + ], 50 + "onDelete": "no action", 51 + "onUpdate": "no action" 52 + } 53 + }, 54 + "compositePrimaryKeys": {}, 55 + "uniqueConstraints": {}, 56 + "policies": {}, 57 + "checkConstraints": {}, 58 + "isRLSEnabled": false 59 + }, 60 + "public.files": { 61 + "name": "files", 62 + "schema": "", 63 + "columns": { 64 + "id": { 65 + "name": "id", 66 + "type": "text", 67 + "primaryKey": true, 68 + "notNull": true, 69 + "default": "xata_id()" 70 + }, 71 + "content": { 72 + "name": "content", 73 + "type": "text", 74 + "primaryKey": false, 75 + "notNull": true 76 + }, 77 + "created_at": { 78 + "name": "created_at", 79 + "type": "timestamp", 80 + "primaryKey": false, 81 + "notNull": true, 82 + "default": "now()" 83 + }, 84 + "updated_at": { 85 + "name": "updated_at", 86 + "type": "timestamp", 87 + "primaryKey": false, 88 + "notNull": true, 89 + "default": "now()" 90 + } 91 + }, 92 + "indexes": {}, 93 + "foreignKeys": {}, 94 + "compositePrimaryKeys": {}, 95 + "uniqueConstraints": {}, 96 + "policies": {}, 97 + "checkConstraints": {}, 98 + "isRLSEnabled": false 99 + }, 100 + "public.sandbox_files": { 101 + "name": "sandbox_files", 102 + "schema": "", 103 + "columns": { 104 + "id": { 105 + "name": "id", 106 + "type": "text", 107 + "primaryKey": true, 108 + "notNull": true, 109 + "default": "xata_id()" 110 + }, 111 + "sandbox_id": { 112 + "name": "sandbox_id", 113 + "type": "text", 114 + "primaryKey": false, 115 + "notNull": true 116 + }, 117 + "file_id": { 118 + "name": "file_id", 119 + "type": "text", 120 + "primaryKey": false, 121 + "notNull": true 122 + }, 123 + "path": { 124 + "name": "path", 125 + "type": "text", 126 + "primaryKey": false, 127 + "notNull": true 128 + }, 129 + "created_at": { 130 + "name": "created_at", 131 + "type": "timestamp", 132 + "primaryKey": false, 133 + "notNull": true, 134 + "default": "now()" 135 + }, 136 + "updated_at": { 137 + "name": "updated_at", 138 + "type": "timestamp", 139 + "primaryKey": false, 140 + "notNull": true, 141 + "default": "now()" 142 + } 143 + }, 144 + "indexes": { 145 + "unique_sandbox_file": { 146 + "name": "unique_sandbox_file", 147 + "columns": [ 148 + { 149 + "expression": "sandbox_id", 150 + "isExpression": false, 151 + "asc": true, 152 + "nulls": "last" 153 + }, 154 + { 155 + "expression": "file_id", 156 + "isExpression": false, 157 + "asc": true, 158 + "nulls": "last" 159 + } 160 + ], 161 + "isUnique": true, 162 + "concurrently": false, 163 + "method": "btree", 164 + "with": {} 165 + }, 166 + "unique_sandbox_file_path": { 167 + "name": "unique_sandbox_file_path", 168 + "columns": [ 169 + { 170 + "expression": "sandbox_id", 171 + "isExpression": false, 172 + "asc": true, 173 + "nulls": "last" 174 + }, 175 + { 176 + "expression": "path", 177 + "isExpression": false, 178 + "asc": true, 179 + "nulls": "last" 180 + } 181 + ], 182 + "isUnique": true, 183 + "concurrently": false, 184 + "method": "btree", 185 + "with": {} 186 + } 187 + }, 188 + "foreignKeys": { 189 + "sandbox_files_sandbox_id_sandboxes_id_fk": { 190 + "name": "sandbox_files_sandbox_id_sandboxes_id_fk", 191 + "tableFrom": "sandbox_files", 192 + "tableTo": "sandboxes", 193 + "columnsFrom": [ 194 + "sandbox_id" 195 + ], 196 + "columnsTo": [ 197 + "id" 198 + ], 199 + "onDelete": "no action", 200 + "onUpdate": "no action" 201 + }, 202 + "sandbox_files_file_id_files_id_fk": { 203 + "name": "sandbox_files_file_id_files_id_fk", 204 + "tableFrom": "sandbox_files", 205 + "tableTo": "files", 206 + "columnsFrom": [ 207 + "file_id" 208 + ], 209 + "columnsTo": [ 210 + "id" 211 + ], 212 + "onDelete": "no action", 213 + "onUpdate": "no action" 214 + } 215 + }, 216 + "compositePrimaryKeys": {}, 217 + "uniqueConstraints": {}, 218 + "policies": {}, 219 + "checkConstraints": {}, 220 + "isRLSEnabled": false 221 + }, 222 + "public.sandbox_ports": { 223 + "name": "sandbox_ports", 224 + "schema": "", 225 + "columns": { 226 + "id": { 227 + "name": "id", 228 + "type": "text", 229 + "primaryKey": true, 230 + "notNull": true, 231 + "default": "xata_id()" 232 + }, 233 + "sandbox_id": { 234 + "name": "sandbox_id", 235 + "type": "text", 236 + "primaryKey": false, 237 + "notNull": true 238 + }, 239 + "exposed_port": { 240 + "name": "exposed_port", 241 + "type": "integer", 242 + "primaryKey": false, 243 + "notNull": true 244 + }, 245 + "preview_url": { 246 + "name": "preview_url", 247 + "type": "text", 248 + "primaryKey": false, 249 + "notNull": false 250 + }, 251 + "created_at": { 252 + "name": "created_at", 253 + "type": "timestamp", 254 + "primaryKey": false, 255 + "notNull": true, 256 + "default": "now()" 257 + }, 258 + "updated_at": { 259 + "name": "updated_at", 260 + "type": "timestamp", 261 + "primaryKey": false, 262 + "notNull": true, 263 + "default": "now()" 264 + } 265 + }, 266 + "indexes": { 267 + "unique_sandbox_port": { 268 + "name": "unique_sandbox_port", 269 + "columns": [ 270 + { 271 + "expression": "sandbox_id", 272 + "isExpression": false, 273 + "asc": true, 274 + "nulls": "last" 275 + }, 276 + { 277 + "expression": "exposed_port", 278 + "isExpression": false, 279 + "asc": true, 280 + "nulls": "last" 281 + } 282 + ], 283 + "isUnique": true, 284 + "concurrently": false, 285 + "method": "btree", 286 + "with": {} 287 + } 288 + }, 289 + "foreignKeys": { 290 + "sandbox_ports_sandbox_id_sandboxes_id_fk": { 291 + "name": "sandbox_ports_sandbox_id_sandboxes_id_fk", 292 + "tableFrom": "sandbox_ports", 293 + "tableTo": "sandboxes", 294 + "columnsFrom": [ 295 + "sandbox_id" 296 + ], 297 + "columnsTo": [ 298 + "id" 299 + ], 300 + "onDelete": "no action", 301 + "onUpdate": "no action" 302 + } 303 + }, 304 + "compositePrimaryKeys": {}, 305 + "uniqueConstraints": {}, 306 + "policies": {}, 307 + "checkConstraints": {}, 308 + "isRLSEnabled": false 309 + }, 310 + "public.sandbox_secrets": { 311 + "name": "sandbox_secrets", 312 + "schema": "", 313 + "columns": { 314 + "id": { 315 + "name": "id", 316 + "type": "text", 317 + "primaryKey": true, 318 + "notNull": true, 319 + "default": "xata_id()" 320 + }, 321 + "sandbox_id": { 322 + "name": "sandbox_id", 323 + "type": "text", 324 + "primaryKey": false, 325 + "notNull": true 326 + }, 327 + "secret_id": { 328 + "name": "secret_id", 329 + "type": "text", 330 + "primaryKey": false, 331 + "notNull": true 332 + }, 333 + "name": { 334 + "name": "name", 335 + "type": "text", 336 + "primaryKey": false, 337 + "notNull": false 338 + }, 339 + "created_at": { 340 + "name": "created_at", 341 + "type": "timestamp", 342 + "primaryKey": false, 343 + "notNull": true, 344 + "default": "now()" 345 + }, 346 + "updated_at": { 347 + "name": "updated_at", 348 + "type": "timestamp", 349 + "primaryKey": false, 350 + "notNull": true, 351 + "default": "now()" 352 + } 353 + }, 354 + "indexes": { 355 + "unique_sandbox_secret": { 356 + "name": "unique_sandbox_secret", 357 + "columns": [ 358 + { 359 + "expression": "sandbox_id", 360 + "isExpression": false, 361 + "asc": true, 362 + "nulls": "last" 363 + }, 364 + { 365 + "expression": "secret_id", 366 + "isExpression": false, 367 + "asc": true, 368 + "nulls": "last" 369 + } 370 + ], 371 + "isUnique": true, 372 + "concurrently": false, 373 + "method": "btree", 374 + "with": {} 375 + }, 376 + "unique_sandbox_secret_by_name": { 377 + "name": "unique_sandbox_secret_by_name", 378 + "columns": [ 379 + { 380 + "expression": "sandbox_id", 381 + "isExpression": false, 382 + "asc": true, 383 + "nulls": "last" 384 + }, 385 + { 386 + "expression": "name", 387 + "isExpression": false, 388 + "asc": true, 389 + "nulls": "last" 390 + } 391 + ], 392 + "isUnique": true, 393 + "concurrently": false, 394 + "method": "btree", 395 + "with": {} 396 + } 397 + }, 398 + "foreignKeys": { 399 + "sandbox_secrets_sandbox_id_sandboxes_id_fk": { 400 + "name": "sandbox_secrets_sandbox_id_sandboxes_id_fk", 401 + "tableFrom": "sandbox_secrets", 402 + "tableTo": "sandboxes", 403 + "columnsFrom": [ 404 + "sandbox_id" 405 + ], 406 + "columnsTo": [ 407 + "id" 408 + ], 409 + "onDelete": "no action", 410 + "onUpdate": "no action" 411 + }, 412 + "sandbox_secrets_secret_id_secrets_id_fk": { 413 + "name": "sandbox_secrets_secret_id_secrets_id_fk", 414 + "tableFrom": "sandbox_secrets", 415 + "tableTo": "secrets", 416 + "columnsFrom": [ 417 + "secret_id" 418 + ], 419 + "columnsTo": [ 420 + "id" 421 + ], 422 + "onDelete": "no action", 423 + "onUpdate": "no action" 424 + } 425 + }, 426 + "compositePrimaryKeys": {}, 427 + "uniqueConstraints": {}, 428 + "policies": {}, 429 + "checkConstraints": {}, 430 + "isRLSEnabled": false 431 + }, 432 + "public.sandbox_variables": { 433 + "name": "sandbox_variables", 434 + "schema": "", 435 + "columns": { 436 + "id": { 437 + "name": "id", 438 + "type": "text", 439 + "primaryKey": true, 440 + "notNull": true, 441 + "default": "xata_id()" 442 + }, 443 + "sandbox_id": { 444 + "name": "sandbox_id", 445 + "type": "text", 446 + "primaryKey": false, 447 + "notNull": true 448 + }, 449 + "variable_id": { 450 + "name": "variable_id", 451 + "type": "text", 452 + "primaryKey": false, 453 + "notNull": true 454 + }, 455 + "name": { 456 + "name": "name", 457 + "type": "text", 458 + "primaryKey": false, 459 + "notNull": true 460 + }, 461 + "created_at": { 462 + "name": "created_at", 463 + "type": "timestamp", 464 + "primaryKey": false, 465 + "notNull": true, 466 + "default": "now()" 467 + }, 468 + "updated_at": { 469 + "name": "updated_at", 470 + "type": "timestamp", 471 + "primaryKey": false, 472 + "notNull": true, 473 + "default": "now()" 474 + } 475 + }, 476 + "indexes": { 477 + "unique_sandbox_variables": { 478 + "name": "unique_sandbox_variables", 479 + "columns": [ 480 + { 481 + "expression": "sandbox_id", 482 + "isExpression": false, 483 + "asc": true, 484 + "nulls": "last" 485 + }, 486 + { 487 + "expression": "variable_id", 488 + "isExpression": false, 489 + "asc": true, 490 + "nulls": "last" 491 + } 492 + ], 493 + "isUnique": true, 494 + "concurrently": false, 495 + "method": "btree", 496 + "with": {} 497 + }, 498 + "unique_sandbox_variables_by_name": { 499 + "name": "unique_sandbox_variables_by_name", 500 + "columns": [ 501 + { 502 + "expression": "sandbox_id", 503 + "isExpression": false, 504 + "asc": true, 505 + "nulls": "last" 506 + }, 507 + { 508 + "expression": "name", 509 + "isExpression": false, 510 + "asc": true, 511 + "nulls": "last" 512 + } 513 + ], 514 + "isUnique": true, 515 + "concurrently": false, 516 + "method": "btree", 517 + "with": {} 518 + } 519 + }, 520 + "foreignKeys": { 521 + "sandbox_variables_sandbox_id_sandboxes_id_fk": { 522 + "name": "sandbox_variables_sandbox_id_sandboxes_id_fk", 523 + "tableFrom": "sandbox_variables", 524 + "tableTo": "sandboxes", 525 + "columnsFrom": [ 526 + "sandbox_id" 527 + ], 528 + "columnsTo": [ 529 + "id" 530 + ], 531 + "onDelete": "no action", 532 + "onUpdate": "no action" 533 + }, 534 + "sandbox_variables_variable_id_variables_id_fk": { 535 + "name": "sandbox_variables_variable_id_variables_id_fk", 536 + "tableFrom": "sandbox_variables", 537 + "tableTo": "variables", 538 + "columnsFrom": [ 539 + "variable_id" 540 + ], 541 + "columnsTo": [ 542 + "id" 543 + ], 544 + "onDelete": "no action", 545 + "onUpdate": "no action" 546 + } 547 + }, 548 + "compositePrimaryKeys": {}, 549 + "uniqueConstraints": {}, 550 + "policies": {}, 551 + "checkConstraints": {}, 552 + "isRLSEnabled": false 553 + }, 554 + "public.sandbox_volumes": { 555 + "name": "sandbox_volumes", 556 + "schema": "", 557 + "columns": { 558 + "id": { 559 + "name": "id", 560 + "type": "text", 561 + "primaryKey": true, 562 + "notNull": true, 563 + "default": "xata_id()" 564 + }, 565 + "sandbox_id": { 566 + "name": "sandbox_id", 567 + "type": "text", 568 + "primaryKey": false, 569 + "notNull": true 570 + }, 571 + "volume_id": { 572 + "name": "volume_id", 573 + "type": "text", 574 + "primaryKey": false, 575 + "notNull": true 576 + }, 577 + "name": { 578 + "name": "name", 579 + "type": "text", 580 + "primaryKey": false, 581 + "notNull": false 582 + }, 583 + "path": { 584 + "name": "path", 585 + "type": "text", 586 + "primaryKey": false, 587 + "notNull": true 588 + }, 589 + "created_at": { 590 + "name": "created_at", 591 + "type": "timestamp", 592 + "primaryKey": false, 593 + "notNull": true, 594 + "default": "now()" 595 + }, 596 + "updated_at": { 597 + "name": "updated_at", 598 + "type": "timestamp", 599 + "primaryKey": false, 600 + "notNull": true, 601 + "default": "now()" 602 + } 603 + }, 604 + "indexes": { 605 + "unique_sandbox_volume": { 606 + "name": "unique_sandbox_volume", 607 + "columns": [ 608 + { 609 + "expression": "sandbox_id", 610 + "isExpression": false, 611 + "asc": true, 612 + "nulls": "last" 613 + }, 614 + { 615 + "expression": "volume_id", 616 + "isExpression": false, 617 + "asc": true, 618 + "nulls": "last" 619 + } 620 + ], 621 + "isUnique": true, 622 + "concurrently": false, 623 + "method": "btree", 624 + "with": {} 625 + }, 626 + "unique_sandbox_volume_path": { 627 + "name": "unique_sandbox_volume_path", 628 + "columns": [ 629 + { 630 + "expression": "sandbox_id", 631 + "isExpression": false, 632 + "asc": true, 633 + "nulls": "last" 634 + }, 635 + { 636 + "expression": "path", 637 + "isExpression": false, 638 + "asc": true, 639 + "nulls": "last" 640 + } 641 + ], 642 + "isUnique": true, 643 + "concurrently": false, 644 + "method": "btree", 645 + "with": {} 646 + } 647 + }, 648 + "foreignKeys": { 649 + "sandbox_volumes_sandbox_id_sandboxes_id_fk": { 650 + "name": "sandbox_volumes_sandbox_id_sandboxes_id_fk", 651 + "tableFrom": "sandbox_volumes", 652 + "tableTo": "sandboxes", 653 + "columnsFrom": [ 654 + "sandbox_id" 655 + ], 656 + "columnsTo": [ 657 + "id" 658 + ], 659 + "onDelete": "no action", 660 + "onUpdate": "no action" 661 + }, 662 + "sandbox_volumes_volume_id_volumes_id_fk": { 663 + "name": "sandbox_volumes_volume_id_volumes_id_fk", 664 + "tableFrom": "sandbox_volumes", 665 + "tableTo": "volumes", 666 + "columnsFrom": [ 667 + "volume_id" 668 + ], 669 + "columnsTo": [ 670 + "id" 671 + ], 672 + "onDelete": "no action", 673 + "onUpdate": "no action" 674 + } 675 + }, 676 + "compositePrimaryKeys": {}, 677 + "uniqueConstraints": {}, 678 + "policies": {}, 679 + "checkConstraints": {}, 680 + "isRLSEnabled": false 681 + }, 682 + "public.sandboxes": { 683 + "name": "sandboxes", 684 + "schema": "", 685 + "columns": { 686 + "id": { 687 + "name": "id", 688 + "type": "text", 689 + "primaryKey": true, 690 + "notNull": true, 691 + "default": "sandbox_id()" 692 + }, 693 + "base": { 694 + "name": "base", 695 + "type": "text", 696 + "primaryKey": false, 697 + "notNull": false 698 + }, 699 + "name": { 700 + "name": "name", 701 + "type": "text", 702 + "primaryKey": false, 703 + "notNull": true 704 + }, 705 + "display_name": { 706 + "name": "display_name", 707 + "type": "text", 708 + "primaryKey": false, 709 + "notNull": false 710 + }, 711 + "uri": { 712 + "name": "uri", 713 + "type": "text", 714 + "primaryKey": false, 715 + "notNull": false 716 + }, 717 + "cid": { 718 + "name": "cid", 719 + "type": "text", 720 + "primaryKey": false, 721 + "notNull": false 722 + }, 723 + "repo": { 724 + "name": "repo", 725 + "type": "text", 726 + "primaryKey": false, 727 + "notNull": false 728 + }, 729 + "provider": { 730 + "name": "provider", 731 + "type": "text", 732 + "primaryKey": false, 733 + "notNull": true, 734 + "default": "'cloudflare'" 735 + }, 736 + "description": { 737 + "name": "description", 738 + "type": "text", 739 + "primaryKey": false, 740 + "notNull": false 741 + }, 742 + "topics": { 743 + "name": "topics", 744 + "type": "text[]", 745 + "primaryKey": false, 746 + "notNull": false 747 + }, 748 + "logo": { 749 + "name": "logo", 750 + "type": "text", 751 + "primaryKey": false, 752 + "notNull": false 753 + }, 754 + "readme": { 755 + "name": "readme", 756 + "type": "text", 757 + "primaryKey": false, 758 + "notNull": false 759 + }, 760 + "public_key": { 761 + "name": "public_key", 762 + "type": "text", 763 + "primaryKey": false, 764 + "notNull": true 765 + }, 766 + "user_id": { 767 + "name": "user_id", 768 + "type": "text", 769 + "primaryKey": false, 770 + "notNull": false 771 + }, 772 + "instance_type": { 773 + "name": "instance_type", 774 + "type": "text", 775 + "primaryKey": false, 776 + "notNull": false 777 + }, 778 + "vcpus": { 779 + "name": "vcpus", 780 + "type": "integer", 781 + "primaryKey": false, 782 + "notNull": false 783 + }, 784 + "memory": { 785 + "name": "memory", 786 + "type": "integer", 787 + "primaryKey": false, 788 + "notNull": false 789 + }, 790 + "disk": { 791 + "name": "disk", 792 + "type": "integer", 793 + "primaryKey": false, 794 + "notNull": false 795 + }, 796 + "status": { 797 + "name": "status", 798 + "type": "text", 799 + "primaryKey": false, 800 + "notNull": true 801 + }, 802 + "keep_alive": { 803 + "name": "keep_alive", 804 + "type": "boolean", 805 + "primaryKey": false, 806 + "notNull": true, 807 + "default": false 808 + }, 809 + "sleep_after": { 810 + "name": "sleep_after", 811 + "type": "text", 812 + "primaryKey": false, 813 + "notNull": false 814 + }, 815 + "sandbox_id": { 816 + "name": "sandbox_id", 817 + "type": "text", 818 + "primaryKey": false, 819 + "notNull": false 820 + }, 821 + "installs": { 822 + "name": "installs", 823 + "type": "integer", 824 + "primaryKey": false, 825 + "notNull": true, 826 + "default": 0 827 + }, 828 + "started_at": { 829 + "name": "started_at", 830 + "type": "timestamp", 831 + "primaryKey": false, 832 + "notNull": false 833 + }, 834 + "created_at": { 835 + "name": "created_at", 836 + "type": "timestamp", 837 + "primaryKey": false, 838 + "notNull": true, 839 + "default": "now()" 840 + }, 841 + "updated_at": { 842 + "name": "updated_at", 843 + "type": "timestamp", 844 + "primaryKey": false, 845 + "notNull": true, 846 + "default": "now()" 847 + } 848 + }, 849 + "indexes": {}, 850 + "foreignKeys": { 851 + "sandboxes_user_id_users_id_fk": { 852 + "name": "sandboxes_user_id_users_id_fk", 853 + "tableFrom": "sandboxes", 854 + "tableTo": "users", 855 + "columnsFrom": [ 856 + "user_id" 857 + ], 858 + "columnsTo": [ 859 + "id" 860 + ], 861 + "onDelete": "no action", 862 + "onUpdate": "no action" 863 + } 864 + }, 865 + "compositePrimaryKeys": {}, 866 + "uniqueConstraints": { 867 + "sandboxes_name_unique": { 868 + "name": "sandboxes_name_unique", 869 + "nullsNotDistinct": false, 870 + "columns": [ 871 + "name" 872 + ] 873 + }, 874 + "sandboxes_uri_unique": { 875 + "name": "sandboxes_uri_unique", 876 + "nullsNotDistinct": false, 877 + "columns": [ 878 + "uri" 879 + ] 880 + }, 881 + "sandboxes_cid_unique": { 882 + "name": "sandboxes_cid_unique", 883 + "nullsNotDistinct": false, 884 + "columns": [ 885 + "cid" 886 + ] 887 + } 888 + }, 889 + "policies": {}, 890 + "checkConstraints": {}, 891 + "isRLSEnabled": false 892 + }, 893 + "public.secrets": { 894 + "name": "secrets", 895 + "schema": "", 896 + "columns": { 897 + "id": { 898 + "name": "id", 899 + "type": "text", 900 + "primaryKey": true, 901 + "notNull": true, 902 + "default": "secret_id()" 903 + }, 904 + "name": { 905 + "name": "name", 906 + "type": "text", 907 + "primaryKey": false, 908 + "notNull": true 909 + }, 910 + "value": { 911 + "name": "value", 912 + "type": "text", 913 + "primaryKey": false, 914 + "notNull": true 915 + }, 916 + "redacted": { 917 + "name": "redacted", 918 + "type": "text", 919 + "primaryKey": false, 920 + "notNull": false 921 + }, 922 + "created_at": { 923 + "name": "created_at", 924 + "type": "timestamp", 925 + "primaryKey": false, 926 + "notNull": true, 927 + "default": "now()" 928 + } 929 + }, 930 + "indexes": {}, 931 + "foreignKeys": {}, 932 + "compositePrimaryKeys": {}, 933 + "uniqueConstraints": {}, 934 + "policies": {}, 935 + "checkConstraints": {}, 936 + "isRLSEnabled": false 937 + }, 938 + "public.snapshots": { 939 + "name": "snapshots", 940 + "schema": "", 941 + "columns": { 942 + "id": { 943 + "name": "id", 944 + "type": "text", 945 + "primaryKey": true, 946 + "notNull": true, 947 + "default": "snapshot_id()" 948 + }, 949 + "slug": { 950 + "name": "slug", 951 + "type": "text", 952 + "primaryKey": false, 953 + "notNull": true 954 + }, 955 + "created_at": { 956 + "name": "created_at", 957 + "type": "timestamp", 958 + "primaryKey": false, 959 + "notNull": true, 960 + "default": "now()" 961 + } 962 + }, 963 + "indexes": {}, 964 + "foreignKeys": {}, 965 + "compositePrimaryKeys": {}, 966 + "uniqueConstraints": { 967 + "snapshots_slug_unique": { 968 + "name": "snapshots_slug_unique", 969 + "nullsNotDistinct": false, 970 + "columns": [ 971 + "slug" 972 + ] 973 + } 974 + }, 975 + "policies": {}, 976 + "checkConstraints": {}, 977 + "isRLSEnabled": false 978 + }, 979 + "public.ssh_keys": { 980 + "name": "ssh_keys", 981 + "schema": "", 982 + "columns": { 983 + "id": { 984 + "name": "id", 985 + "type": "text", 986 + "primaryKey": true, 987 + "notNull": true, 988 + "default": "xata_id()" 989 + }, 990 + "sandbox_id": { 991 + "name": "sandbox_id", 992 + "type": "text", 993 + "primaryKey": false, 994 + "notNull": true 995 + }, 996 + "public_key": { 997 + "name": "public_key", 998 + "type": "text", 999 + "primaryKey": false, 1000 + "notNull": true 1001 + }, 1002 + "private_key": { 1003 + "name": "private_key", 1004 + "type": "text", 1005 + "primaryKey": false, 1006 + "notNull": true 1007 + }, 1008 + "redacted": { 1009 + "name": "redacted", 1010 + "type": "text", 1011 + "primaryKey": false, 1012 + "notNull": false 1013 + }, 1014 + "created_at": { 1015 + "name": "created_at", 1016 + "type": "timestamp", 1017 + "primaryKey": false, 1018 + "notNull": true, 1019 + "default": "now()" 1020 + } 1021 + }, 1022 + "indexes": { 1023 + "unique_sandbox_ssh_key": { 1024 + "name": "unique_sandbox_ssh_key", 1025 + "columns": [ 1026 + { 1027 + "expression": "public_key", 1028 + "isExpression": false, 1029 + "asc": true, 1030 + "nulls": "last" 1031 + }, 1032 + { 1033 + "expression": "sandbox_id", 1034 + "isExpression": false, 1035 + "asc": true, 1036 + "nulls": "last" 1037 + } 1038 + ], 1039 + "isUnique": true, 1040 + "concurrently": false, 1041 + "method": "btree", 1042 + "with": {} 1043 + } 1044 + }, 1045 + "foreignKeys": { 1046 + "ssh_keys_sandbox_id_sandboxes_id_fk": { 1047 + "name": "ssh_keys_sandbox_id_sandboxes_id_fk", 1048 + "tableFrom": "ssh_keys", 1049 + "tableTo": "sandboxes", 1050 + "columnsFrom": [ 1051 + "sandbox_id" 1052 + ], 1053 + "columnsTo": [ 1054 + "id" 1055 + ], 1056 + "onDelete": "no action", 1057 + "onUpdate": "no action" 1058 + } 1059 + }, 1060 + "compositePrimaryKeys": {}, 1061 + "uniqueConstraints": {}, 1062 + "policies": {}, 1063 + "checkConstraints": {}, 1064 + "isRLSEnabled": false 1065 + }, 1066 + "public.tailscale_auth_keys": { 1067 + "name": "tailscale_auth_keys", 1068 + "schema": "", 1069 + "columns": { 1070 + "id": { 1071 + "name": "id", 1072 + "type": "text", 1073 + "primaryKey": true, 1074 + "notNull": true, 1075 + "default": "xata_id()" 1076 + }, 1077 + "sandbox_id": { 1078 + "name": "sandbox_id", 1079 + "type": "text", 1080 + "primaryKey": false, 1081 + "notNull": true 1082 + }, 1083 + "auth_key": { 1084 + "name": "auth_key", 1085 + "type": "text", 1086 + "primaryKey": false, 1087 + "notNull": true 1088 + }, 1089 + "redacted": { 1090 + "name": "redacted", 1091 + "type": "text", 1092 + "primaryKey": false, 1093 + "notNull": true 1094 + }, 1095 + "created_at": { 1096 + "name": "created_at", 1097 + "type": "timestamp", 1098 + "primaryKey": false, 1099 + "notNull": true, 1100 + "default": "now()" 1101 + } 1102 + }, 1103 + "indexes": {}, 1104 + "foreignKeys": { 1105 + "tailscale_auth_keys_sandbox_id_sandboxes_id_fk": { 1106 + "name": "tailscale_auth_keys_sandbox_id_sandboxes_id_fk", 1107 + "tableFrom": "tailscale_auth_keys", 1108 + "tableTo": "sandboxes", 1109 + "columnsFrom": [ 1110 + "sandbox_id" 1111 + ], 1112 + "columnsTo": [ 1113 + "id" 1114 + ], 1115 + "onDelete": "no action", 1116 + "onUpdate": "no action" 1117 + } 1118 + }, 1119 + "compositePrimaryKeys": {}, 1120 + "uniqueConstraints": {}, 1121 + "policies": {}, 1122 + "checkConstraints": {}, 1123 + "isRLSEnabled": false 1124 + }, 1125 + "public.users": { 1126 + "name": "users", 1127 + "schema": "", 1128 + "columns": { 1129 + "id": { 1130 + "name": "id", 1131 + "type": "text", 1132 + "primaryKey": true, 1133 + "notNull": true, 1134 + "default": "xata_id()" 1135 + }, 1136 + "did": { 1137 + "name": "did", 1138 + "type": "text", 1139 + "primaryKey": false, 1140 + "notNull": true 1141 + }, 1142 + "display_name": { 1143 + "name": "display_name", 1144 + "type": "text", 1145 + "primaryKey": false, 1146 + "notNull": false 1147 + }, 1148 + "handle": { 1149 + "name": "handle", 1150 + "type": "text", 1151 + "primaryKey": false, 1152 + "notNull": true 1153 + }, 1154 + "avatar": { 1155 + "name": "avatar", 1156 + "type": "text", 1157 + "primaryKey": false, 1158 + "notNull": false 1159 + }, 1160 + "created_at": { 1161 + "name": "created_at", 1162 + "type": "timestamp", 1163 + "primaryKey": false, 1164 + "notNull": true, 1165 + "default": "now()" 1166 + }, 1167 + "updated_at": { 1168 + "name": "updated_at", 1169 + "type": "timestamp", 1170 + "primaryKey": false, 1171 + "notNull": true, 1172 + "default": "now()" 1173 + } 1174 + }, 1175 + "indexes": {}, 1176 + "foreignKeys": {}, 1177 + "compositePrimaryKeys": {}, 1178 + "uniqueConstraints": { 1179 + "users_did_unique": { 1180 + "name": "users_did_unique", 1181 + "nullsNotDistinct": false, 1182 + "columns": [ 1183 + "did" 1184 + ] 1185 + }, 1186 + "users_handle_unique": { 1187 + "name": "users_handle_unique", 1188 + "nullsNotDistinct": false, 1189 + "columns": [ 1190 + "handle" 1191 + ] 1192 + } 1193 + }, 1194 + "policies": {}, 1195 + "checkConstraints": {}, 1196 + "isRLSEnabled": false 1197 + }, 1198 + "public.variables": { 1199 + "name": "variables", 1200 + "schema": "", 1201 + "columns": { 1202 + "id": { 1203 + "name": "id", 1204 + "type": "text", 1205 + "primaryKey": true, 1206 + "notNull": true, 1207 + "default": "variable_id()" 1208 + }, 1209 + "name": { 1210 + "name": "name", 1211 + "type": "text", 1212 + "primaryKey": false, 1213 + "notNull": true 1214 + }, 1215 + "value": { 1216 + "name": "value", 1217 + "type": "text", 1218 + "primaryKey": false, 1219 + "notNull": true 1220 + }, 1221 + "created_at": { 1222 + "name": "created_at", 1223 + "type": "timestamp", 1224 + "primaryKey": false, 1225 + "notNull": true, 1226 + "default": "now()" 1227 + }, 1228 + "updated_at": { 1229 + "name": "updated_at", 1230 + "type": "timestamp", 1231 + "primaryKey": false, 1232 + "notNull": true, 1233 + "default": "now()" 1234 + } 1235 + }, 1236 + "indexes": {}, 1237 + "foreignKeys": {}, 1238 + "compositePrimaryKeys": {}, 1239 + "uniqueConstraints": {}, 1240 + "policies": {}, 1241 + "checkConstraints": {}, 1242 + "isRLSEnabled": false 1243 + }, 1244 + "public.volumes": { 1245 + "name": "volumes", 1246 + "schema": "", 1247 + "columns": { 1248 + "id": { 1249 + "name": "id", 1250 + "type": "text", 1251 + "primaryKey": true, 1252 + "notNull": true, 1253 + "default": "volume_id()" 1254 + }, 1255 + "slug": { 1256 + "name": "slug", 1257 + "type": "text", 1258 + "primaryKey": false, 1259 + "notNull": true 1260 + }, 1261 + "size": { 1262 + "name": "size", 1263 + "type": "integer", 1264 + "primaryKey": false, 1265 + "notNull": true 1266 + }, 1267 + "size_unit": { 1268 + "name": "size_unit", 1269 + "type": "text", 1270 + "primaryKey": false, 1271 + "notNull": true 1272 + }, 1273 + "created_at": { 1274 + "name": "created_at", 1275 + "type": "timestamp", 1276 + "primaryKey": false, 1277 + "notNull": true, 1278 + "default": "now()" 1279 + }, 1280 + "updated_at": { 1281 + "name": "updated_at", 1282 + "type": "timestamp", 1283 + "primaryKey": false, 1284 + "notNull": true, 1285 + "default": "now()" 1286 + } 1287 + }, 1288 + "indexes": {}, 1289 + "foreignKeys": {}, 1290 + "compositePrimaryKeys": {}, 1291 + "uniqueConstraints": { 1292 + "volumes_slug_unique": { 1293 + "name": "volumes_slug_unique", 1294 + "nullsNotDistinct": false, 1295 + "columns": [ 1296 + "slug" 1297 + ] 1298 + } 1299 + }, 1300 + "policies": {}, 1301 + "checkConstraints": {}, 1302 + "isRLSEnabled": false 1303 + }, 1304 + "public.integrations": { 1305 + "name": "integrations", 1306 + "schema": "", 1307 + "columns": { 1308 + "id": { 1309 + "name": "id", 1310 + "type": "text", 1311 + "primaryKey": true, 1312 + "notNull": true, 1313 + "default": "xata_id()" 1314 + }, 1315 + "sandbox_id": { 1316 + "name": "sandbox_id", 1317 + "type": "text", 1318 + "primaryKey": false, 1319 + "notNull": true 1320 + }, 1321 + "name": { 1322 + "name": "name", 1323 + "type": "text", 1324 + "primaryKey": false, 1325 + "notNull": true 1326 + }, 1327 + "description": { 1328 + "name": "description", 1329 + "type": "text", 1330 + "primaryKey": false, 1331 + "notNull": false 1332 + }, 1333 + "webhook_url": { 1334 + "name": "webhook_url", 1335 + "type": "text", 1336 + "primaryKey": false, 1337 + "notNull": true 1338 + }, 1339 + "created_at": { 1340 + "name": "created_at", 1341 + "type": "timestamp", 1342 + "primaryKey": false, 1343 + "notNull": true, 1344 + "default": "now()" 1345 + } 1346 + }, 1347 + "indexes": { 1348 + "unique_sandbox_integration": { 1349 + "name": "unique_sandbox_integration", 1350 + "columns": [ 1351 + { 1352 + "expression": "sandbox_id", 1353 + "isExpression": false, 1354 + "asc": true, 1355 + "nulls": "last" 1356 + }, 1357 + { 1358 + "expression": "name", 1359 + "isExpression": false, 1360 + "asc": true, 1361 + "nulls": "last" 1362 + } 1363 + ], 1364 + "isUnique": true, 1365 + "concurrently": false, 1366 + "method": "btree", 1367 + "with": {} 1368 + } 1369 + }, 1370 + "foreignKeys": { 1371 + "integrations_sandbox_id_sandboxes_id_fk": { 1372 + "name": "integrations_sandbox_id_sandboxes_id_fk", 1373 + "tableFrom": "integrations", 1374 + "tableTo": "sandboxes", 1375 + "columnsFrom": [ 1376 + "sandbox_id" 1377 + ], 1378 + "columnsTo": [ 1379 + "id" 1380 + ], 1381 + "onDelete": "no action", 1382 + "onUpdate": "no action" 1383 + } 1384 + }, 1385 + "compositePrimaryKeys": {}, 1386 + "uniqueConstraints": {}, 1387 + "policies": {}, 1388 + "checkConstraints": {}, 1389 + "isRLSEnabled": false 1390 + } 1391 + }, 1392 + "enums": {}, 1393 + "schemas": {}, 1394 + "sequences": {}, 1395 + "roles": {}, 1396 + "policies": {}, 1397 + "views": {}, 1398 + "_meta": { 1399 + "columns": {}, 1400 + "schemas": {}, 1401 + "tables": {} 1402 + } 1403 + }
+7
apps/cf-sandbox/drizzle/meta/_journal.json
··· 197 197 "when": 1773258112498, 198 198 "tag": "0027_cooing_rattler", 199 199 "breakpoints": true 200 + }, 201 + { 202 + "idx": 28, 203 + "version": "7", 204 + "when": 1773901834037, 205 + "tag": "0028_quiet_korvac", 206 + "breakpoints": true 200 207 } 201 208 ] 202 209 }
+2
apps/cf-sandbox/src/schema/index.ts
··· 11 11 import sandboxFiles from "./sandbox-files"; 12 12 import tailscaleAuthKeys from "./tailscale-auth-keys"; 13 13 import sshKeys from "./ssh-keys"; 14 + import sandboxPorts from "./sandbox-ports"; 14 15 15 16 export { 16 17 sandboxes, ··· 26 27 sandboxFiles, 27 28 tailscaleAuthKeys, 28 29 sshKeys, 30 + sandboxPorts, 29 31 };
+31
apps/cf-sandbox/src/schema/sandbox-ports.ts
··· 1 + import { type InferInsertModel, type InferSelectModel, sql } from "drizzle-orm"; 2 + import { 3 + pgTable, 4 + text, 5 + timestamp, 6 + uniqueIndex, 7 + integer, 8 + } from "drizzle-orm/pg-core"; 9 + import sandboxes from "./sandboxes"; 10 + 11 + const sandboxPorts = pgTable( 12 + "sandbox_ports", 13 + { 14 + id: text("id") 15 + .primaryKey() 16 + .default(sql`xata_id()`), 17 + sandboxId: text("sandbox_id") 18 + .notNull() 19 + .references(() => sandboxes.id), 20 + exposedPort: integer("exposed_port").notNull(), 21 + previewUrl: text("preview_url"), 22 + createdAt: timestamp("created_at").defaultNow().notNull(), 23 + updatedAt: timestamp("updated_at").defaultNow().notNull(), 24 + }, 25 + (t) => [uniqueIndex("unique_sandbox_port").on(t.sandboxId, t.exposedPort)], 26 + ); 27 + 28 + export type SelectSandboxPort = InferSelectModel<typeof sandboxPorts>; 29 + export type InsertSandboxPort = InferInsertModel<typeof sandboxPorts>; 30 + 31 + export default sandboxPorts;
+2
apps/sandbox/src/schema/mod.ts
··· 11 11 import sandboxFiles from "./sandbox-files.ts"; 12 12 import sshKeys from "./ssh-keys.ts"; 13 13 import tailscaleAuthKeys from "./tailscale-auth-keys.ts"; 14 + import sandboxPorts from "./sandbox-ports.ts"; 14 15 15 16 export { 16 17 sandboxes, ··· 26 27 sandboxFiles, 27 28 sshKeys, 28 29 tailscaleAuthKeys, 30 + sandboxPorts, 29 31 };
+31
apps/sandbox/src/schema/sandbox-ports.ts
··· 1 + import { type InferInsertModel, type InferSelectModel, sql } from "drizzle-orm"; 2 + import { 3 + pgTable, 4 + text, 5 + timestamp, 6 + uniqueIndex, 7 + integer, 8 + } from "drizzle-orm/pg-core"; 9 + import sandboxes from "./sandboxes.ts"; 10 + 11 + const sandboxPorts = pgTable( 12 + "sandbox_ports", 13 + { 14 + id: text("id") 15 + .primaryKey() 16 + .default(sql`xata_id()`), 17 + sandboxId: text("sandbox_id") 18 + .notNull() 19 + .references(() => sandboxes.id), 20 + exposedPort: integer("exposed_port").notNull(), 21 + previewUrl: text("preview_url"), 22 + createdAt: timestamp("created_at").defaultNow().notNull(), 23 + updatedAt: timestamp("updated_at").defaultNow().notNull(), 24 + }, 25 + (t) => [uniqueIndex("unique_sandbox_port").on(t.sandboxId, t.exposedPort)], 26 + ); 27 + 28 + export type SelectSandboxPort = InferSelectModel<typeof sandboxPorts>; 29 + export type InsertSandboxPort = InferInsertModel<typeof sandboxPorts>; 30 + 31 + export default sandboxPorts;