canvas-backend/drizzle/0000_eager_marvel_zombies.sql
2025-01-25 18:23:36 +06:00

27 lines
No EOL
1 KiB
SQL

CREATE TABLE "projects" (
"project_id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"user_id" text,
"object" json,
"name" text,
"description" text,
"created_at" timestamp DEFAULT now(),
"updated_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "uploads" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"filename" text NOT NULL,
"url" text NOT NULL,
"projectId" uuid,
"created_at" timestamp DEFAULT now(),
"updated_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "users" (
"user_id" text PRIMARY KEY NOT NULL,
"paid_status" text NOT NULL,
"expires_in" timestamp NOT NULL
);
--> statement-breakpoint
ALTER TABLE "projects" ADD CONSTRAINT "projects_user_id_users_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("user_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "uploads" ADD CONSTRAINT "uploads_projectId_projects_project_id_fk" FOREIGN KEY ("projectId") REFERENCES "public"."projects"("project_id") ON DELETE no action ON UPDATE no action;