Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/db/drizzle/0015_slack_integration.sql

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ CREATE TABLE "secrets" (
CONSTRAINT "secrets_project_key_unique" UNIQUE("project_id","key")
);
--> statement-breakpoint
CREATE TABLE "users__slack_users" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"slack_user_id" text NOT NULL,
"team_id" text NOT NULL,
"user_id" uuid NOT NULL,
"organization_id" uuid NOT NULL,
"model_preference" text,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "users__slack_users_unique" UNIQUE("slack_user_id","team_id")
);
--> statement-breakpoint
CREATE TABLE "workspaces" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"organization_id" uuid NOT NULL,
Expand All @@ -51,25 +62,29 @@ CREATE TABLE "workspaces" (
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "repositories" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
DROP TABLE "repositories" CASCADE;--> statement-breakpoint
ALTER TABLE "tasks" DROP CONSTRAINT "tasks_repository_id_repositories_id_fk";
--> statement-breakpoint
DROP INDEX "tasks_repository_id_idx";--> statement-breakpoint
ALTER TABLE "repositories" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
DROP TABLE "repositories" CASCADE;--> statement-breakpoint
ALTER TABLE "projects" ADD CONSTRAINT "projects_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "auth"."organizations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "projects" ADD CONSTRAINT "projects_github_repository_id_github_repositories_id_fk" FOREIGN KEY ("github_repository_id") REFERENCES "public"."github_repositories"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "sandbox_images" ADD CONSTRAINT "sandbox_images_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "auth"."organizations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "sandbox_images" ADD CONSTRAINT "sandbox_images_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "secrets" ADD CONSTRAINT "secrets_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "auth"."organizations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "secrets" ADD CONSTRAINT "secrets_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "secrets" ADD CONSTRAINT "secrets_created_by_user_id_users_id_fk" FOREIGN KEY ("created_by_user_id") REFERENCES "auth"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "users__slack_users" ADD CONSTRAINT "users__slack_users_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "users__slack_users" ADD CONSTRAINT "users__slack_users_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "auth"."organizations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "workspaces" ADD CONSTRAINT "workspaces_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "auth"."organizations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "workspaces" ADD CONSTRAINT "workspaces_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "workspaces" ADD CONSTRAINT "workspaces_created_by_user_id_users_id_fk" FOREIGN KEY ("created_by_user_id") REFERENCES "auth"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "projects_organization_id_idx" ON "projects" USING btree ("organization_id");--> statement-breakpoint
CREATE INDEX "sandbox_images_organization_id_idx" ON "sandbox_images" USING btree ("organization_id");--> statement-breakpoint
CREATE INDEX "secrets_project_id_idx" ON "secrets" USING btree ("project_id");--> statement-breakpoint
CREATE INDEX "secrets_organization_id_idx" ON "secrets" USING btree ("organization_id");--> statement-breakpoint
CREATE INDEX "users__slack_users_user_idx" ON "users__slack_users" USING btree ("user_id");--> statement-breakpoint
CREATE INDEX "users__slack_users_org_idx" ON "users__slack_users" USING btree ("organization_id");--> statement-breakpoint
CREATE INDEX "workspaces_project_id_idx" ON "workspaces" USING btree ("project_id");--> statement-breakpoint
CREATE INDEX "workspaces_organization_id_idx" ON "workspaces" USING btree ("organization_id");--> statement-breakpoint
CREATE INDEX "workspaces_type_idx" ON "workspaces" USING btree ("type");--> statement-breakpoint
Expand Down
15 changes: 0 additions & 15 deletions packages/db/drizzle/0019_add_users_slack_connect.sql

This file was deleted.

128 changes: 127 additions & 1 deletion packages/db/drizzle/meta/0018_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "05ee7aa5-2712-498d-bd5b-4ec93f526e83",
"id": "697ef9b1-c76c-45e0-a476-54c589374f17",
"prevId": "02acb4cb-aaf7-4617-8d27-cb6f1c492d95",
"version": "7",
"dialect": "postgresql",
Expand Down Expand Up @@ -3703,6 +3703,132 @@
"checkConstraints": {},
"isRLSEnabled": false
},
"public.users__slack_users": {
"name": "users__slack_users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"slack_user_id": {
"name": "slack_user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"team_id": {
"name": "team_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"organization_id": {
"name": "organization_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"model_preference": {
"name": "model_preference",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"users__slack_users_user_idx": {
"name": "users__slack_users_user_idx",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"users__slack_users_org_idx": {
"name": "users__slack_users_org_idx",
"columns": [
{
"expression": "organization_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"users__slack_users_user_id_users_id_fk": {
"name": "users__slack_users_user_id_users_id_fk",
"tableFrom": "users__slack_users",
"tableTo": "users",
"schemaTo": "auth",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"users__slack_users_organization_id_organizations_id_fk": {
"name": "users__slack_users_organization_id_organizations_id_fk",
"tableFrom": "users__slack_users",
"tableTo": "organizations",
"schemaTo": "auth",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"users__slack_users_unique": {
"name": "users__slack_users_unique",
"nullsNotDistinct": false,
"columns": [
"slack_user_id",
"team_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.workspaces": {
"name": "workspaces",
"schema": "",
Expand Down
Loading