|
|
|
|
@@ -1,153 +0,0 @@
|
|
|
|
|
CREATE TABLE "user_temp" (
|
|
|
|
|
"id" text PRIMARY KEY NOT NULL,
|
|
|
|
|
"name" text DEFAULT '' NOT NULL,
|
|
|
|
|
"token" text NOT NULL,
|
|
|
|
|
"isRegistered" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"expirationDate" text NOT NULL,
|
|
|
|
|
"createdAt" text NOT NULL,
|
|
|
|
|
"canCreateProjects" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"canAccessToSSHKeys" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"canCreateServices" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"canDeleteProjects" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"canDeleteServices" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"canAccessToDocker" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"canAccessToAPI" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"canAccessToGitProviders" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"canAccessToTraefikFiles" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"accesedProjects" text[] DEFAULT ARRAY[]::text[] NOT NULL,
|
|
|
|
|
"accesedServices" text[] DEFAULT ARRAY[]::text[] NOT NULL,
|
|
|
|
|
"email" text NOT NULL,
|
|
|
|
|
"email_verified" boolean NOT NULL,
|
|
|
|
|
"image" text,
|
|
|
|
|
"role" text,
|
|
|
|
|
"banned" boolean,
|
|
|
|
|
"ban_reason" text,
|
|
|
|
|
"ban_expires" timestamp,
|
|
|
|
|
"updated_at" timestamp NOT NULL,
|
|
|
|
|
"serverIp" text,
|
|
|
|
|
"certificateType" "certificateType" DEFAULT 'none' NOT NULL,
|
|
|
|
|
"host" text,
|
|
|
|
|
"letsEncryptEmail" text,
|
|
|
|
|
"sshPrivateKey" text,
|
|
|
|
|
"enableDockerCleanup" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"enableLogRotation" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"enablePaidFeatures" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"metricsConfig" jsonb DEFAULT '{"server":{"type":"Dokploy","refreshRate":60,"port":4500,"token":"","retentionDays":2,"cronJob":"","urlCallback":"","thresholds":{"cpu":0,"memory":0}},"containers":{"refreshRate":60,"services":{"include":[],"exclude":[]}}}'::jsonb NOT NULL,
|
|
|
|
|
"cleanupCacheApplications" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"cleanupCacheOnPreviews" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"cleanupCacheOnCompose" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"stripeCustomerId" text,
|
|
|
|
|
"stripeSubscriptionId" text,
|
|
|
|
|
"serversQuantity" integer DEFAULT 0 NOT NULL,
|
|
|
|
|
CONSTRAINT "user_temp_email_unique" UNIQUE("email")
|
|
|
|
|
);
|
|
|
|
|
--> statement-breakpoint
|
|
|
|
|
CREATE TABLE "session_temp" (
|
|
|
|
|
"id" text PRIMARY KEY NOT NULL,
|
|
|
|
|
"expires_at" timestamp NOT NULL,
|
|
|
|
|
"token" text NOT NULL,
|
|
|
|
|
"created_at" timestamp NOT NULL,
|
|
|
|
|
"updated_at" timestamp NOT NULL,
|
|
|
|
|
"ip_address" text,
|
|
|
|
|
"user_agent" text,
|
|
|
|
|
"user_id" text NOT NULL,
|
|
|
|
|
"impersonated_by" text,
|
|
|
|
|
"active_organization_id" text,
|
|
|
|
|
CONSTRAINT "session_temp_token_unique" UNIQUE("token")
|
|
|
|
|
);
|
|
|
|
|
--> statement-breakpoint
|
|
|
|
|
CREATE TABLE "account" (
|
|
|
|
|
"id" text PRIMARY KEY NOT NULL,
|
|
|
|
|
"account_id" text NOT NULL,
|
|
|
|
|
"provider_id" text NOT NULL,
|
|
|
|
|
"user_id" text NOT NULL,
|
|
|
|
|
"access_token" text,
|
|
|
|
|
"refresh_token" text,
|
|
|
|
|
"id_token" text,
|
|
|
|
|
"access_token_expires_at" timestamp,
|
|
|
|
|
"refresh_token_expires_at" timestamp,
|
|
|
|
|
"scope" text,
|
|
|
|
|
"password" text,
|
|
|
|
|
"is2FAEnabled" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"created_at" timestamp NOT NULL,
|
|
|
|
|
"updated_at" timestamp NOT NULL,
|
|
|
|
|
"resetPasswordToken" text,
|
|
|
|
|
"resetPasswordExpiresAt" text,
|
|
|
|
|
"confirmationToken" text,
|
|
|
|
|
"confirmationExpiresAt" text
|
|
|
|
|
);
|
|
|
|
|
--> statement-breakpoint
|
|
|
|
|
CREATE TABLE "invitation" (
|
|
|
|
|
"id" text PRIMARY KEY NOT NULL,
|
|
|
|
|
"organization_id" text NOT NULL,
|
|
|
|
|
"email" text NOT NULL,
|
|
|
|
|
"role" text,
|
|
|
|
|
"status" text NOT NULL,
|
|
|
|
|
"expires_at" timestamp NOT NULL,
|
|
|
|
|
"inviter_id" text NOT NULL
|
|
|
|
|
);
|
|
|
|
|
--> statement-breakpoint
|
|
|
|
|
CREATE TABLE "member" (
|
|
|
|
|
"id" text PRIMARY KEY NOT NULL,
|
|
|
|
|
"organization_id" text NOT NULL,
|
|
|
|
|
"user_id" text NOT NULL,
|
|
|
|
|
"role" text NOT NULL,
|
|
|
|
|
"created_at" timestamp NOT NULL
|
|
|
|
|
);
|
|
|
|
|
--> statement-breakpoint
|
|
|
|
|
CREATE TABLE "organization" (
|
|
|
|
|
"id" text PRIMARY KEY NOT NULL,
|
|
|
|
|
"name" text NOT NULL,
|
|
|
|
|
"slug" text,
|
|
|
|
|
"logo" text,
|
|
|
|
|
"created_at" timestamp NOT NULL,
|
|
|
|
|
"metadata" text,
|
|
|
|
|
"owner_id" text NOT NULL,
|
|
|
|
|
CONSTRAINT "organization_slug_unique" UNIQUE("slug")
|
|
|
|
|
);
|
|
|
|
|
--> statement-breakpoint
|
|
|
|
|
CREATE TABLE "verification" (
|
|
|
|
|
"id" text PRIMARY KEY NOT NULL,
|
|
|
|
|
"identifier" text NOT NULL,
|
|
|
|
|
"value" text NOT NULL,
|
|
|
|
|
"expires_at" timestamp NOT NULL,
|
|
|
|
|
"created_at" timestamp,
|
|
|
|
|
"updated_at" timestamp
|
|
|
|
|
);
|
|
|
|
|
--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "project" RENAME COLUMN "adminId" TO "userId";--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "destination" RENAME COLUMN "adminId" TO "userId";--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "certificate" RENAME COLUMN "adminId" TO "userId";--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "registry" RENAME COLUMN "adminId" TO "userId";--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "notification" RENAME COLUMN "adminId" TO "userId";--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "git_provider" RENAME COLUMN "adminId" TO "userId";--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "server" RENAME COLUMN "adminId" TO "userId";--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "project" DROP CONSTRAINT "project_adminId_admin_adminId_fk";
|
|
|
|
|
--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "destination" DROP CONSTRAINT "destination_adminId_admin_adminId_fk";
|
|
|
|
|
--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "certificate" DROP CONSTRAINT "certificate_adminId_admin_adminId_fk";
|
|
|
|
|
--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "registry" DROP CONSTRAINT "registry_adminId_admin_adminId_fk";
|
|
|
|
|
--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "notification" DROP CONSTRAINT "notification_adminId_admin_adminId_fk";
|
|
|
|
|
--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "git_provider" DROP CONSTRAINT "git_provider_adminId_admin_adminId_fk";
|
|
|
|
|
--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "server" DROP CONSTRAINT "server_adminId_admin_adminId_fk";
|
|
|
|
|
--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "ssh-key" ALTER COLUMN "adminId" SET NOT NULL;--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "session_temp" ADD CONSTRAINT "session_temp_user_id_user_temp_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user_temp"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "account" ADD CONSTRAINT "account_user_id_user_temp_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user_temp"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "invitation" ADD CONSTRAINT "invitation_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "invitation" ADD CONSTRAINT "invitation_inviter_id_user_temp_id_fk" FOREIGN KEY ("inviter_id") REFERENCES "public"."user_temp"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "member" ADD CONSTRAINT "member_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "member" ADD CONSTRAINT "member_user_id_user_temp_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user_temp"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "organization" ADD CONSTRAINT "organization_owner_id_user_temp_id_fk" FOREIGN KEY ("owner_id") REFERENCES "public"."user_temp"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "project" ADD CONSTRAINT "project_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "destination" ADD CONSTRAINT "destination_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "certificate" ADD CONSTRAINT "certificate_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "registry" ADD CONSTRAINT "registry_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "notification" ADD CONSTRAINT "notification_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "git_provider" ADD CONSTRAINT "git_provider_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
|
|
|
ALTER TABLE "server" ADD CONSTRAINT "server_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;
|