46 lines
1.6 KiB
SQL
46 lines
1.6 KiB
SQL
CREATE SCHEMA "account";
|
|
--> statement-breakpoint
|
|
CREATE TABLE "account"."account" (
|
|
"userId" text NOT NULL,
|
|
"type" text NOT NULL,
|
|
"provider" text NOT NULL,
|
|
"providerAccountId" text NOT NULL,
|
|
"refresh_token" text,
|
|
"access_token" text,
|
|
"expires_at" integer,
|
|
"token_type" text,
|
|
"scope" text,
|
|
"id_token" text,
|
|
"session_state" text,
|
|
CONSTRAINT "account_provider_providerAccountId_pk" PRIMARY KEY("provider","providerAccountId")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "account"."session" (
|
|
"sessionToken" text PRIMARY KEY NOT NULL,
|
|
"userId" text NOT NULL,
|
|
"expires" timestamp NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "account"."user" (
|
|
"id" text PRIMARY KEY NOT NULL,
|
|
"name" text,
|
|
"email" text,
|
|
"emailVerified" timestamp,
|
|
"image" text,
|
|
"discord_id" text,
|
|
CONSTRAINT "user_email_unique" UNIQUE("email")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "account"."verificationToken" (
|
|
"identifier" text NOT NULL,
|
|
"token" text NOT NULL,
|
|
"expires" timestamp NOT NULL,
|
|
CONSTRAINT "verificationToken_identifier_token_pk" PRIMARY KEY("identifier","token")
|
|
);
|
|
--> statement-breakpoint
|
|
DROP TABLE "account" CASCADE;--> statement-breakpoint
|
|
DROP TABLE "session" CASCADE;--> statement-breakpoint
|
|
DROP TABLE "user" CASCADE;--> statement-breakpoint
|
|
DROP TABLE "verificationToken" CASCADE;--> statement-breakpoint
|
|
ALTER TABLE "account"."account" ADD CONSTRAINT "account_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "account"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "account"."session" ADD CONSTRAINT "session_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "account"."user"("id") ON DELETE cascade ON UPDATE no action; |