27 lines
1.2 KiB
SQL
27 lines
1.2 KiB
SQL
CREATE TABLE "packages" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"slug" text NOT NULL,
|
|
"name" text NOT NULL,
|
|
"vcpu" integer NOT NULL,
|
|
"ram" integer NOT NULL,
|
|
"disk" integer NOT NULL,
|
|
"price_monthly" numeric(10, 2) NOT NULL,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
CONSTRAINT "packages_slug_unique" UNIQUE("slug")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "wms" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"project_id" uuid NOT NULL,
|
|
"name" text NOT NULL,
|
|
"package_id" uuid,
|
|
"vcpu" integer NOT NULL,
|
|
"ram" integer NOT NULL,
|
|
"disk" integer NOT NULL,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "wms" ADD CONSTRAINT "wms_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "wms" ADD CONSTRAINT "wms_package_id_packages_id_fk" FOREIGN KEY ("package_id") REFERENCES "public"."packages"("id") ON DELETE no action ON UPDATE no action; |