CREATE TABLE IF NOT EXISTS "accounts" ( "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 ); --> statement-breakpoint ALTER TABLE "accounts" ADD CONSTRAINT "accounts_provider_providerAccountId" PRIMARY KEY("provider","providerAccountId"); CREATE TABLE IF NOT EXISTS "sessions" ( "userId" text NOT NULL, "sessionToken" text PRIMARY KEY NOT NULL, "expires" integer NOT NULL ); CREATE TABLE IF NOT EXISTS "users" ( "id" text PRIMARY KEY NOT NULL, "name" text, "email" text NOT NULL, "emailVerified" integer, "image" text ); CREATE TABLE IF NOT EXISTS "verificationToken" ( "identifier" text NOT NULL, "token" text NOT NULL, "expires" integer NOT NULL ); --> statement-breakpoint ALTER TABLE "verificationToken" ADD CONSTRAINT "verificationToken_identifier_token" PRIMARY KEY("identifier","token"); DO $$ BEGIN ALTER TABLE "accounts" ADD CONSTRAINT "accounts_userId_users_id_fk" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE cascade ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; DO $$ BEGIN ALTER TABLE "sessions" ADD CONSTRAINT "sessions_userId_users_id_fk" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE cascade ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$;