@void/platform 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +58 -0
  3. package/dist/index.d.mts +264 -0
  4. package/dist/index.mjs +895 -0
  5. package/dist/installer.d.mts +49 -0
  6. package/dist/installer.mjs +176 -0
  7. package/dist/runtime/api/README.md +1 -0
  8. package/dist/runtime/api/index.js +70824 -0
  9. package/dist/runtime/api/index.js.map +8 -0
  10. package/dist/runtime/dispatch/README.md +1 -0
  11. package/dist/runtime/dispatch/index.js +3289 -0
  12. package/dist/runtime/dispatch/index.js.map +8 -0
  13. package/dist/runtime/drizzle/0000_confused_starjammers.sql +66 -0
  14. package/dist/runtime/drizzle/0001_famous_magus.sql +15 -0
  15. package/dist/runtime/drizzle/0002_glorious_morgan_stark.sql +17 -0
  16. package/dist/runtime/drizzle/0003_awesome_ares.sql +3 -0
  17. package/dist/runtime/drizzle/0004_talented_mimic.sql +1 -0
  18. package/dist/runtime/drizzle/0005_legal_red_ghost.sql +15 -0
  19. package/dist/runtime/drizzle/0006_wonderful_madame_masque.sql +17 -0
  20. package/dist/runtime/drizzle/0007_normal_skin.sql +4 -0
  21. package/dist/runtime/drizzle/0008_auth_codes.sql +5 -0
  22. package/dist/runtime/drizzle/0009_chubby_masked_marvel.sql +1 -0
  23. package/dist/runtime/drizzle/0010_wild_aqueduct.sql +10 -0
  24. package/dist/runtime/drizzle/0011_curly_stryfe.sql +2 -0
  25. package/dist/runtime/drizzle/0012_eminent_mystique.sql +1 -0
  26. package/dist/runtime/drizzle/0013_quick_selene.sql +3 -0
  27. package/dist/runtime/drizzle/0014_mysterious_medusa.sql +1 -0
  28. package/dist/runtime/drizzle/0015_backfill_accepted_invitations.sql +14 -0
  29. package/dist/runtime/drizzle/0016_verified_phoenix.sql +1 -0
  30. package/dist/runtime/drizzle/0017_gorgeous_johnny_blaze.sql +3 -0
  31. package/dist/runtime/drizzle/0018_project_migrations.sql +21 -0
  32. package/dist/runtime/drizzle/0019_project_database_credentials.sql +10 -0
  33. package/dist/runtime/drizzle/0027_github_deploy.sql +82 -0
  34. package/dist/runtime/drizzle/0028_check_runs.sql +1 -0
  35. package/dist/runtime/drizzle/0029_fluffy_justin_hammer.sql +1 -0
  36. package/dist/runtime/drizzle/0030_smooth_marvel_boy.sql +13 -0
  37. package/dist/runtime/drizzle/0031_thankful_madame_masque.sql +9 -0
  38. package/dist/runtime/drizzle/0032_remarkable_skullbuster.sql +10 -0
  39. package/dist/runtime/drizzle/0033_operator_sessions_and_events.sql +21 -0
  40. package/dist/runtime/drizzle/0034_email_destinations.sql +21 -0
  41. package/dist/runtime/drizzle/0035_invitation_actor_history.sql +5 -0
  42. package/dist/runtime/drizzle/0036_flowery_master_chief.sql +2 -0
  43. package/dist/runtime/drizzle/0037_unusual_bloodaxe.sql +14 -0
  44. package/dist/runtime/drizzle/0038_deployment_admission_protocol.sql +25 -0
  45. package/dist/runtime/drizzle/compatibility.json +26 -0
  46. package/dist/runtime/drizzle/meta/_journal.json +230 -0
  47. package/dist/runtime/manifest.json +254 -0
  48. package/dist/runtime/proxy/README.md +1 -0
  49. package/dist/runtime/proxy/index.js +5416 -0
  50. package/dist/runtime/proxy/index.js.map +8 -0
  51. package/dist/runtime/tail/README.md +1 -0
  52. package/dist/runtime/tail/index.js +61 -0
  53. package/dist/runtime/tail/index.js.map +8 -0
  54. package/package.json +40 -0
@@ -0,0 +1,66 @@
1
+ CREATE TABLE "deployments" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "project_id" text NOT NULL,
4
+ "status" text DEFAULT 'pending' NOT NULL,
5
+ "manifest" text,
6
+ "source" text,
7
+ "commit" text,
8
+ "error_message" text,
9
+ "asset_hashes" text,
10
+ "created_at" timestamp DEFAULT now() NOT NULL,
11
+ "deployed_at" timestamp
12
+ );
13
+ --> statement-breakpoint
14
+ CREATE TABLE "domains" (
15
+ "id" text PRIMARY KEY NOT NULL,
16
+ "project_id" text NOT NULL,
17
+ "hostname" text NOT NULL,
18
+ "cf_hostname_id" text NOT NULL,
19
+ "status" text DEFAULT 'pending' NOT NULL,
20
+ "created_at" timestamp DEFAULT now() NOT NULL,
21
+ CONSTRAINT "domains_hostname_unique" UNIQUE("hostname")
22
+ );
23
+ --> statement-breakpoint
24
+ CREATE TABLE "projects" (
25
+ "id" text PRIMARY KEY NOT NULL,
26
+ "user_id" text NOT NULL,
27
+ "slug" text NOT NULL,
28
+ "mode" text DEFAULT 'worker' NOT NULL,
29
+ "created_at" timestamp DEFAULT now() NOT NULL,
30
+ CONSTRAINT "projects_user_id_slug_unique" UNIQUE("user_id","slug")
31
+ );
32
+ --> statement-breakpoint
33
+ CREATE TABLE "resources" (
34
+ "id" text PRIMARY KEY NOT NULL,
35
+ "project_id" text NOT NULL,
36
+ "type" text NOT NULL,
37
+ "cf_id" text NOT NULL,
38
+ "binding_name" text NOT NULL,
39
+ "created_at" timestamp DEFAULT now() NOT NULL,
40
+ CONSTRAINT "resources_project_id_type_binding_name_unique" UNIQUE("project_id","type","binding_name")
41
+ );
42
+ --> statement-breakpoint
43
+ CREATE TABLE "users" (
44
+ "id" text PRIMARY KEY NOT NULL,
45
+ "provider" text DEFAULT 'github' NOT NULL,
46
+ "provider_id" text DEFAULT '' NOT NULL,
47
+ "login" text DEFAULT '' NOT NULL,
48
+ "email" text,
49
+ "plan" text DEFAULT 'free' NOT NULL,
50
+ "role" text DEFAULT 'user' NOT NULL,
51
+ "billing_cycle_start" timestamp DEFAULT now() NOT NULL,
52
+ "suspended_reason" text,
53
+ "created_at" timestamp DEFAULT now() NOT NULL
54
+ );
55
+ --> statement-breakpoint
56
+ ALTER TABLE "deployments" ADD CONSTRAINT "deployments_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
57
+ ALTER TABLE "domains" ADD CONSTRAINT "domains_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
58
+ ALTER TABLE "projects" ADD CONSTRAINT "projects_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
59
+ ALTER TABLE "resources" ADD CONSTRAINT "resources_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
60
+ CREATE INDEX "idx_deployments_project_id" ON "deployments" USING btree ("project_id","created_at");--> statement-breakpoint
61
+ CREATE INDEX "idx_deployments_project_status" ON "deployments" USING btree ("project_id","status");--> statement-breakpoint
62
+ CREATE INDEX "idx_domains_project_id" ON "domains" USING btree ("project_id","created_at");--> statement-breakpoint
63
+ CREATE UNIQUE INDEX "idx_projects_slug" ON "projects" USING btree ("slug");--> statement-breakpoint
64
+ CREATE INDEX "idx_projects_user_id" ON "projects" USING btree ("user_id");--> statement-breakpoint
65
+ CREATE UNIQUE INDEX "idx_users_provider_id" ON "users" USING btree ("provider","provider_id");--> statement-breakpoint
66
+ CREATE INDEX "idx_users_email" ON "users" USING btree ("email");
@@ -0,0 +1,15 @@
1
+ CREATE TABLE "oauth_accounts" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "user_id" text NOT NULL,
4
+ "provider" text NOT NULL,
5
+ "provider_id" text NOT NULL,
6
+ "created_at" timestamp DEFAULT now() NOT NULL
7
+ );
8
+ --> statement-breakpoint
9
+ ALTER TABLE "oauth_accounts" ADD CONSTRAINT "oauth_accounts_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
10
+ CREATE UNIQUE INDEX "idx_oauth_accounts_provider_id" ON "oauth_accounts" USING btree ("provider","provider_id");--> statement-breakpoint
11
+ CREATE INDEX "idx_oauth_accounts_user_id" ON "oauth_accounts" USING btree ("user_id");--> statement-breakpoint
12
+ INSERT INTO "oauth_accounts" ("id", "user_id", "provider", "provider_id", "created_at")
13
+ SELECT concat('oa_', substring(replace(gen_random_uuid()::text, '-', ''), 1, 12)),
14
+ id, provider, provider_id, created_at
15
+ FROM "users" WHERE provider_id != '';
@@ -0,0 +1,17 @@
1
+ CREATE TABLE "platform_events" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "batch_id" text,
4
+ "action" text NOT NULL,
5
+ "worker_name" text NOT NULL,
6
+ "environment" text NOT NULL,
7
+ "version_id" text NOT NULL,
8
+ "script_name" text NOT NULL,
9
+ "status" text DEFAULT 'pending' NOT NULL,
10
+ "error_message" text,
11
+ "admin_user_id" text NOT NULL,
12
+ "admin_login" text NOT NULL,
13
+ "created_at" timestamp DEFAULT now() NOT NULL
14
+ );
15
+ --> statement-breakpoint
16
+ CREATE INDEX "idx_platform_events_batch_id" ON "platform_events" USING btree ("batch_id");--> statement-breakpoint
17
+ CREATE INDEX "idx_platform_events_env_created" ON "platform_events" USING btree ("environment","created_at");
@@ -0,0 +1,3 @@
1
+ ALTER TABLE "deployments" ADD COLUMN "retained" boolean DEFAULT false NOT NULL;--> statement-breakpoint
2
+ ALTER TABLE "deployments" ADD COLUMN "applied_migrations" text;--> statement-breakpoint
3
+ ALTER TABLE "projects" ADD COLUMN "active_deployment_id" text;
@@ -0,0 +1 @@
1
+ ALTER TABLE "projects" ADD COLUMN "websocket_version" integer DEFAULT 0 NOT NULL;
@@ -0,0 +1,15 @@
1
+ CREATE TABLE "project_secrets" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "project_id" text NOT NULL,
4
+ "name" text NOT NULL,
5
+ "ciphertext" text NOT NULL,
6
+ "iv" text NOT NULL,
7
+ "key_version" text NOT NULL,
8
+ "managed_reason" text,
9
+ "created_at" timestamp DEFAULT now() NOT NULL,
10
+ "updated_at" timestamp DEFAULT now() NOT NULL,
11
+ CONSTRAINT "project_secrets_project_id_name_unique" UNIQUE("project_id","name")
12
+ );
13
+ --> statement-breakpoint
14
+ ALTER TABLE "project_secrets" ADD CONSTRAINT "project_secrets_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
15
+ CREATE INDEX "idx_project_secrets_project_id" ON "project_secrets" USING btree ("project_id");
@@ -0,0 +1,17 @@
1
+ CREATE TABLE "invitations" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "email" text NOT NULL,
4
+ "status" text DEFAULT 'pending' NOT NULL,
5
+ "invited_by" text NOT NULL,
6
+ "accepted_by" text,
7
+ "revoked_at" timestamp,
8
+ "revoked_by" text,
9
+ "created_at" timestamp DEFAULT now() NOT NULL,
10
+ "accepted_at" timestamp
11
+ );
12
+ --> statement-breakpoint
13
+ ALTER TABLE "invitations" ADD CONSTRAINT "invitations_invited_by_users_id_fk" FOREIGN KEY ("invited_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
14
+ ALTER TABLE "invitations" ADD CONSTRAINT "invitations_accepted_by_users_id_fk" FOREIGN KEY ("accepted_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
15
+ ALTER TABLE "invitations" ADD CONSTRAINT "invitations_revoked_by_users_id_fk" FOREIGN KEY ("revoked_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
16
+ CREATE INDEX "idx_invitations_email" ON "invitations" USING btree ("email");--> statement-breakpoint
17
+ CREATE INDEX "idx_invitations_status" ON "invitations" USING btree ("status");
@@ -0,0 +1,4 @@
1
+ CREATE TABLE "oauth_nonces" (
2
+ "nonce" text PRIMARY KEY NOT NULL,
3
+ "expires_at" timestamp NOT NULL
4
+ );
@@ -0,0 +1,5 @@
1
+ CREATE TABLE "auth_codes" (
2
+ "code" text PRIMARY KEY NOT NULL,
3
+ "jwt" text NOT NULL,
4
+ "expires_at" timestamp NOT NULL
5
+ );
@@ -0,0 +1 @@
1
+ ALTER TABLE "deployments" ADD COLUMN "updated_at" timestamp DEFAULT now() NOT NULL;
@@ -0,0 +1,10 @@
1
+ CREATE TABLE "migration_renames" (
2
+ "project_id" text NOT NULL,
3
+ "from_name" text NOT NULL,
4
+ "to_name" text NOT NULL,
5
+ "created_at" timestamp DEFAULT now() NOT NULL,
6
+ CONSTRAINT "migration_renames_project_id_from_name_to_name_pk" PRIMARY KEY("project_id","from_name","to_name")
7
+ );
8
+ --> statement-breakpoint
9
+ ALTER TABLE "migration_renames" ADD CONSTRAINT "migration_renames_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
10
+ CREATE INDEX "idx_migration_renames_project_id" ON "migration_renames" USING btree ("project_id");
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "projects" ADD COLUMN "status" text DEFAULT 'active' NOT NULL;--> statement-breakpoint
2
+ ALTER TABLE "resources" ADD COLUMN "metadata" jsonb DEFAULT '{}'::jsonb NOT NULL;
@@ -0,0 +1 @@
1
+ ALTER TABLE "deployments" ADD COLUMN "bundle_stored" boolean DEFAULT false NOT NULL;
@@ -0,0 +1,3 @@
1
+ ALTER TABLE "deployments" ADD COLUMN "repository_url" text;--> statement-breakpoint
2
+ ALTER TABLE "deployments" ADD COLUMN "commit_url" text;--> statement-breakpoint
3
+ ALTER TABLE "deployments" ADD COLUMN "git_ref" text;
@@ -0,0 +1 @@
1
+ ALTER TABLE "deployments" ADD COLUMN "cli_version" text;
@@ -0,0 +1,14 @@
1
+ UPDATE "invitations"
2
+ SET
3
+ "status" = 'accepted',
4
+ "accepted_by" = "users"."id",
5
+ "accepted_at" = COALESCE(
6
+ "invitations"."accepted_at",
7
+ GREATEST("invitations"."created_at", "users"."created_at"),
8
+ now()
9
+ )
10
+ FROM "users"
11
+ WHERE
12
+ "invitations"."status" = 'pending'
13
+ AND "users"."email" IS NOT NULL
14
+ AND lower("invitations"."email") = lower("users"."email");
@@ -0,0 +1 @@
1
+ ALTER TABLE "domains" ADD COLUMN "verification_data" jsonb;
@@ -0,0 +1,3 @@
1
+ ALTER TABLE "auth_codes" ADD COLUMN "cli_state" text;--> statement-breakpoint
2
+ ALTER TABLE "auth_codes" ADD COLUMN "code_challenge" text;--> statement-breakpoint
3
+ ALTER TABLE "auth_codes" ADD COLUMN "code_challenge_method" text;
@@ -0,0 +1,21 @@
1
+ CREATE TABLE "project_migrations" (
2
+ "project_id" text NOT NULL,
3
+ "name" text NOT NULL,
4
+ "applied_at" timestamp DEFAULT now() NOT NULL,
5
+ "source_deployment_id" text,
6
+ "created_at" timestamp DEFAULT now() NOT NULL,
7
+ CONSTRAINT "project_migrations_project_id_name_pk" PRIMARY KEY("project_id","name")
8
+ );
9
+ --> statement-breakpoint
10
+ ALTER TABLE "project_migrations" ADD CONSTRAINT "project_migrations_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;
11
+ --> statement-breakpoint
12
+ ALTER TABLE "project_migrations" ADD CONSTRAINT "project_migrations_source_deployment_id_deployments_id_fk" FOREIGN KEY ("source_deployment_id") REFERENCES "public"."deployments"("id") ON DELETE set null ON UPDATE no action;
13
+ --> statement-breakpoint
14
+ CREATE INDEX "idx_project_migrations_project_id" ON "project_migrations" USING btree ("project_id","applied_at");
15
+ --> statement-breakpoint
16
+ INSERT INTO "project_migrations" ("project_id", "name", "source_deployment_id")
17
+ SELECT DISTINCT d."project_id", migration.name, d."id"
18
+ FROM "deployments" d
19
+ CROSS JOIN LATERAL jsonb_array_elements_text((d."applied_migrations")::jsonb) AS migration(name)
20
+ WHERE d."applied_migrations" IS NOT NULL
21
+ ON CONFLICT DO NOTHING;
@@ -0,0 +1,10 @@
1
+ CREATE TABLE "project_database_credentials" (
2
+ "project_id" text PRIMARY KEY NOT NULL,
3
+ "ciphertext" text NOT NULL,
4
+ "iv" text NOT NULL,
5
+ "key_version" text NOT NULL,
6
+ "created_at" timestamp DEFAULT now() NOT NULL,
7
+ "updated_at" timestamp DEFAULT now() NOT NULL
8
+ );
9
+ --> statement-breakpoint
10
+ ALTER TABLE "project_database_credentials" ADD CONSTRAINT "project_database_credentials_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;
@@ -0,0 +1,82 @@
1
+ CREATE TABLE IF NOT EXISTS "builds" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "project_id" text NOT NULL,
4
+ "user_id" text NOT NULL,
5
+ "executor" text DEFAULT 'container' NOT NULL,
6
+ "status" text DEFAULT 'queued' NOT NULL,
7
+ "commit_sha" text,
8
+ "branch" text,
9
+ "deployment_id" text,
10
+ "github_run_id" text,
11
+ "github_run_attempt" text,
12
+ "logs_url" text,
13
+ "error" text,
14
+ "exit_code" integer,
15
+ "instance_type" text,
16
+ "started_at" timestamp,
17
+ "completed_at" timestamp,
18
+ "created_at" timestamp DEFAULT now() NOT NULL
19
+ );
20
+ --> statement-breakpoint
21
+ CREATE TABLE IF NOT EXISTS "github_connections" (
22
+ "id" text PRIMARY KEY NOT NULL,
23
+ "project_id" text NOT NULL,
24
+ "installation_id" text NOT NULL,
25
+ "repo_full_name" text NOT NULL,
26
+ "repository_id" text,
27
+ "branch" text DEFAULT 'main' NOT NULL,
28
+ "build_executor" text DEFAULT 'container' NOT NULL,
29
+ "created_at" timestamp DEFAULT now() NOT NULL,
30
+ "updated_at" timestamp DEFAULT now() NOT NULL,
31
+ CONSTRAINT "github_connections_project_id_unique" UNIQUE("project_id")
32
+ );
33
+ --> statement-breakpoint
34
+ CREATE TABLE IF NOT EXISTS "github_installations" (
35
+ "id" text PRIMARY KEY NOT NULL,
36
+ "installation_id" text NOT NULL,
37
+ "user_id" text,
38
+ "account_login" text NOT NULL,
39
+ "account_id" text NOT NULL,
40
+ "account_type" text NOT NULL,
41
+ "repositories" jsonb DEFAULT '[]'::jsonb NOT NULL,
42
+ "repository_selection" text DEFAULT 'selected' NOT NULL,
43
+ "status" text DEFAULT 'active' NOT NULL,
44
+ "created_at" timestamp DEFAULT now() NOT NULL,
45
+ "updated_at" timestamp DEFAULT now() NOT NULL,
46
+ CONSTRAINT "github_installations_installation_id_unique" UNIQUE("installation_id")
47
+ );
48
+ --> statement-breakpoint
49
+ DO $$ BEGIN
50
+ ALTER TABLE "builds" ADD CONSTRAINT "builds_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE no action ON UPDATE no action;
51
+ EXCEPTION
52
+ WHEN duplicate_object THEN null;
53
+ END $$;--> statement-breakpoint
54
+ DO $$ BEGIN
55
+ ALTER TABLE "builds" ADD CONSTRAINT "builds_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;
56
+ EXCEPTION
57
+ WHEN duplicate_object THEN null;
58
+ END $$;--> statement-breakpoint
59
+ DO $$ BEGIN
60
+ ALTER TABLE "builds" ADD CONSTRAINT "builds_deployment_id_deployments_id_fk" FOREIGN KEY ("deployment_id") REFERENCES "public"."deployments"("id") ON DELETE no action ON UPDATE no action;
61
+ EXCEPTION
62
+ WHEN duplicate_object THEN null;
63
+ END $$;--> statement-breakpoint
64
+ DO $$ BEGIN
65
+ ALTER TABLE "github_connections" ADD CONSTRAINT "github_connections_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;
66
+ EXCEPTION
67
+ WHEN duplicate_object THEN null;
68
+ END $$;--> statement-breakpoint
69
+ DO $$ BEGIN
70
+ ALTER TABLE "github_installations" ADD CONSTRAINT "github_installations_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;
71
+ EXCEPTION
72
+ WHEN duplicate_object THEN null;
73
+ END $$;--> statement-breakpoint
74
+ CREATE INDEX IF NOT EXISTS "idx_builds_project_created" ON "builds" USING btree ("project_id","created_at");--> statement-breakpoint
75
+ CREATE INDEX IF NOT EXISTS "idx_builds_status" ON "builds" USING btree ("status");--> statement-breakpoint
76
+ CREATE INDEX IF NOT EXISTS "idx_builds_user_status" ON "builds" USING btree ("user_id","status");--> statement-breakpoint
77
+ CREATE UNIQUE INDEX IF NOT EXISTS "idx_builds_project_github_run_id" ON "builds" USING btree ("project_id","github_run_id","github_run_attempt") WHERE "builds"."github_run_id" IS NOT NULL AND "builds"."github_run_attempt" IS NOT NULL AND "builds"."status" IN ('starting', 'building', 'deploying');--> statement-breakpoint
78
+ CREATE INDEX IF NOT EXISTS "idx_github_connections_installation_id" ON "github_connections" USING btree ("installation_id");--> statement-breakpoint
79
+ CREATE INDEX IF NOT EXISTS "idx_github_connections_repo_full_name" ON "github_connections" USING btree ("repo_full_name");--> statement-breakpoint
80
+ CREATE INDEX IF NOT EXISTS "idx_github_connections_installation_repo_id" ON "github_connections" USING btree ("installation_id","repository_id");--> statement-breakpoint
81
+ CREATE INDEX IF NOT EXISTS "idx_github_installations_user_id" ON "github_installations" USING btree ("user_id");--> statement-breakpoint
82
+ CREATE INDEX IF NOT EXISTS "idx_github_installations_account_id" ON "github_installations" USING btree ("account_id");
@@ -0,0 +1 @@
1
+ ALTER TABLE "builds" ADD COLUMN "check_run_id" text;
@@ -0,0 +1 @@
1
+ ALTER TABLE "github_connections" ADD COLUMN "workflow_path" text DEFAULT '.github/workflows/void-deploy.yml' NOT NULL;
@@ -0,0 +1,13 @@
1
+ CREATE TABLE "github_installation_members" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "installation_id" text NOT NULL,
4
+ "user_id" text NOT NULL,
5
+ "github_account_id" text,
6
+ "verified_at" timestamp DEFAULT now() NOT NULL,
7
+ "expires_at" timestamp NOT NULL,
8
+ "created_at" timestamp DEFAULT now() NOT NULL
9
+ );
10
+ --> statement-breakpoint
11
+ ALTER TABLE "github_installation_members" ADD CONSTRAINT "github_installation_members_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
12
+ CREATE UNIQUE INDEX "idx_github_installation_members_install_user" ON "github_installation_members" USING btree ("installation_id","user_id");--> statement-breakpoint
13
+ CREATE INDEX "idx_github_installation_members_user_id" ON "github_installation_members" USING btree ("user_id");
@@ -0,0 +1,9 @@
1
+ CREATE TABLE "github_installation_revocations" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "installation_id" text NOT NULL,
4
+ "github_account_id" text NOT NULL,
5
+ "revoked_at" timestamp with time zone DEFAULT now() NOT NULL,
6
+ "created_at" timestamp DEFAULT now() NOT NULL
7
+ );
8
+ --> statement-breakpoint
9
+ CREATE UNIQUE INDEX "idx_github_installation_revocations_install_account" ON "github_installation_revocations" USING btree ("installation_id","github_account_id");
@@ -0,0 +1,10 @@
1
+ CREATE TABLE "github_webhook_redeliveries" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "guid" text NOT NULL,
4
+ "delivery_id" text NOT NULL,
5
+ "event" text,
6
+ "status_code" integer,
7
+ "redelivered_at" timestamp DEFAULT now() NOT NULL
8
+ );
9
+ --> statement-breakpoint
10
+ CREATE UNIQUE INDEX "idx_github_webhook_redeliveries_guid" ON "github_webhook_redeliveries" USING btree ("guid");
@@ -0,0 +1,21 @@
1
+ CREATE TABLE "operator_events" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "user_id" text NOT NULL,
4
+ "login" text NOT NULL,
5
+ "action" text NOT NULL,
6
+ "target" text NOT NULL,
7
+ "status" text NOT NULL,
8
+ "http_status" integer,
9
+ "created_at" timestamp DEFAULT now() NOT NULL
10
+ );
11
+ --> statement-breakpoint
12
+ CREATE TABLE "operator_sessions" (
13
+ "id" text PRIMARY KEY NOT NULL,
14
+ "user_id" text NOT NULL,
15
+ "expires_at" timestamp NOT NULL,
16
+ "created_at" timestamp DEFAULT now() NOT NULL
17
+ );
18
+ --> statement-breakpoint
19
+ ALTER TABLE "operator_sessions" ADD CONSTRAINT "operator_sessions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
20
+ CREATE INDEX "idx_operator_events_created" ON "operator_events" USING btree ("created_at","id");--> statement-breakpoint
21
+ CREATE INDEX "idx_operator_sessions_expiry" ON "operator_sessions" USING btree ("expires_at");
@@ -0,0 +1,21 @@
1
+ CREATE TABLE "email_destinations" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "project_id" text NOT NULL,
4
+ "address" text NOT NULL,
5
+ "status" text DEFAULT 'pending' NOT NULL,
6
+ "cf_destination_id" text,
7
+ "verified_at" timestamp,
8
+ "verification_source" text DEFAULT 'cf' NOT NULL,
9
+ "verified_by_user_id" text,
10
+ "verified_by_email_snapshot" text,
11
+ "created_at" timestamp DEFAULT now() NOT NULL,
12
+ CONSTRAINT "email_destinations_project_address_uq" UNIQUE("project_id","address"),
13
+ CONSTRAINT "email_destinations_status_check" CHECK ("email_destinations"."status" IN ('pending', 'verified')),
14
+ CONSTRAINT "email_destinations_verification_source_check" CHECK ("email_destinations"."verification_source" IN ('cf', 'platform'))
15
+ );
16
+ --> statement-breakpoint
17
+ ALTER TABLE "email_destinations" ADD CONSTRAINT "email_destinations_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
18
+ ALTER TABLE "email_destinations" ADD CONSTRAINT "email_destinations_verified_by_user_id_users_id_fk" FOREIGN KEY ("verified_by_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
19
+ CREATE INDEX "idx_email_destinations_project_id" ON "email_destinations" USING btree ("project_id");--> statement-breakpoint
20
+ CREATE INDEX "idx_email_destinations_cf_destination_id" ON "email_destinations" USING btree ("cf_destination_id");--> statement-breakpoint
21
+ CREATE INDEX "idx_email_destinations_verified_by_user_id" ON "email_destinations" USING btree ("verified_by_user_id","verified_by_email_snapshot");
@@ -0,0 +1,5 @@
1
+ ALTER TABLE "invitations" DROP CONSTRAINT "invitations_invited_by_users_id_fk";
2
+ --> statement-breakpoint
3
+ ALTER TABLE "invitations" DROP CONSTRAINT "invitations_accepted_by_users_id_fk";
4
+ --> statement-breakpoint
5
+ ALTER TABLE "invitations" DROP CONSTRAINT "invitations_revoked_by_users_id_fk";
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "github_connections" ADD COLUMN "authorized_by_user_id" text;--> statement-breakpoint
2
+ ALTER TABLE "github_connections" ADD CONSTRAINT "github_connections_authorized_by_user_id_users_id_fk" FOREIGN KEY ("authorized_by_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;
@@ -0,0 +1,14 @@
1
+ CREATE TABLE "sandbox_drain_checkpoints" (
2
+ "singleton" boolean PRIMARY KEY NOT NULL,
3
+ "generation" text NOT NULL,
4
+ "state" text NOT NULL,
5
+ "phase" text NOT NULL,
6
+ "cursor" jsonb,
7
+ "lease_owner" text,
8
+ "lease_expires_at" timestamp,
9
+ "started_at" timestamp DEFAULT now() NOT NULL,
10
+ "updated_at" timestamp DEFAULT now() NOT NULL,
11
+ "completed_at" timestamp
12
+ );
13
+ --> statement-breakpoint
14
+ CREATE INDEX "idx_deployments_created_id" ON "deployments" USING btree ("created_at","id");
@@ -0,0 +1,25 @@
1
+ ALTER TABLE "deployments" ADD COLUMN "admission_protocol" integer DEFAULT 0 NOT NULL;--> statement-breakpoint
2
+ ALTER TABLE "sandbox_drain_checkpoints" ADD COLUMN "admission_protocol" integer DEFAULT 0 NOT NULL;--> statement-breakpoint
3
+ INSERT INTO "sandbox_drain_checkpoints" (
4
+ "singleton", "admission_protocol", "generation", "state", "phase", "cursor"
5
+ ) VALUES (
6
+ true, 0, 'deployment-admission-bootstrap', 'draining', 'deployments', '{"pass":"1"}'::jsonb
7
+ ) ON CONFLICT ("singleton") DO NOTHING;--> statement-breakpoint
8
+ CREATE FUNCTION "void_enforce_deployment_admission_protocol"() RETURNS trigger AS $$
9
+ DECLARE
10
+ "required_protocol" integer;
11
+ BEGIN
12
+ SELECT "admission_protocol" INTO "required_protocol"
13
+ FROM "sandbox_drain_checkpoints"
14
+ WHERE "singleton" = true
15
+ FOR SHARE;
16
+ IF COALESCE("required_protocol", 0) > NEW."admission_protocol" THEN
17
+ RAISE EXCEPTION 'deployment admission protocol % is below required protocol %', NEW."admission_protocol", "required_protocol"
18
+ USING ERRCODE = '55000';
19
+ END IF;
20
+ RETURN NEW;
21
+ END;
22
+ $$ LANGUAGE plpgsql;--> statement-breakpoint
23
+ CREATE TRIGGER "deployments_admission_protocol"
24
+ BEFORE INSERT ON "deployments"
25
+ FOR EACH ROW EXECUTE FUNCTION "void_enforce_deployment_admission_protocol"();
@@ -0,0 +1,26 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "lineage": "void-platform-postgresql-v1",
4
+ "rollbackSafeFrom": [
5
+ {
6
+ "platformVersion": "0.10.14",
7
+ "schemaDigest": "9631e7ad6596fc8cd12715d5263d32e94aafd398e5b1689321038232f64dcd74"
8
+ },
9
+ {
10
+ "platformVersion": "0.10.14",
11
+ "schemaDigest": "6a8a3e502f01162731bdf0bdc8b2e86beac443f87629789ee312bfbc03125e47"
12
+ },
13
+ {
14
+ "platformVersion": "0.10.14",
15
+ "schemaDigest": "07b5142d4caea007bb8dc8d0fae2c273e56fd6878282fc2b9a76e414210e2fe3"
16
+ },
17
+ {
18
+ "platformVersion": "0.10.14",
19
+ "schemaDigest": "06c6f91f87d2ad95b1631ae48e2cd671aa6976fe53313947748c07bf2a7d6fda"
20
+ },
21
+ {
22
+ "platformVersion": "0.10.14",
23
+ "schemaDigest": "3dbf4c31d4bc97a11edca35c59b34ffad1f072df0ad7174d69e2de1057e2610b"
24
+ }
25
+ ]
26
+ }