28 lines
No EOL
1 KiB
SQL
28 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,
|
|
"expires_in" text,
|
|
"refresh_token" text
|
|
);
|
|
--> 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; |