roleping-bot/drizzle/0000_outgoing_magneto.sql
2025-11-21 19:04:14 +06:00

17 lines
No EOL
695 B
SQL

CREATE TABLE "role_members" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"role_id" uuid,
"user_id" bigint NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "roles" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"slug" varchar(32) NOT NULL,
"aliases" varchar(32)[] DEFAULT '{}' NOT NULL,
"chat_id" bigint NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "role_members" ADD CONSTRAINT "role_members_role_id_roles_id_fk" FOREIGN KEY ("role_id") REFERENCES "public"."roles"("id") ON DELETE no action ON UPDATE no action;