mirror of
https://github.com/apotdevin/thunderhub.git
synced 2026-08-13 12:33:08 +02:00
19 lines
No EOL
778 B
SQL
19 lines
No EOL
778 B
SQL
CREATE TABLE "teams" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"name" text NOT NULL,
|
|
"created_at" timestamp(6) DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp(6) DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "users" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"email" text NOT NULL,
|
|
"password_hash" text NOT NULL,
|
|
"role" text DEFAULT 'member' NOT NULL,
|
|
"team_id" uuid NOT NULL,
|
|
"created_at" timestamp(6) DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp(6) DEFAULT now() NOT NULL,
|
|
CONSTRAINT "users_email_unique" UNIQUE("email")
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "users" ADD CONSTRAINT "users_team_id_teams_id_fk" FOREIGN KEY ("team_id") REFERENCES "public"."teams"("id") ON DELETE no action ON UPDATE no action; |