mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-30 03:25:22 +02:00
137 lines
5.9 KiB
SQL
137 lines
5.9 KiB
SQL
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,
|
|
"two_factor_enabled" boolean DEFAULT false NOT NULL,
|
|
"email" text NOT NULL,
|
|
"email_verified" boolean NOT NULL,
|
|
"image" 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,
|
|
"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
|
|
);
|
|
--> 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
|
|
);
|
|
|
|
CREATE TABLE "two_factor" (
|
|
"id" text PRIMARY KEY NOT NULL,
|
|
"secret" text NOT NULL,
|
|
"backup_codes" text NOT NULL,
|
|
"user_id" text NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "certificate" ALTER COLUMN "adminId" SET NOT NULL;--> statement-breakpoint
|
|
ALTER TABLE "notification" ALTER COLUMN "adminId" SET NOT NULL;--> statement-breakpoint
|
|
ALTER TABLE "ssh-key" ALTER COLUMN "adminId" SET NOT NULL;--> statement-breakpoint
|
|
ALTER TABLE "git_provider" 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;
|
|
ALTER TABLE "two_factor" ADD CONSTRAINT "two_factor_user_id_user_temp_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|