CREATE TABLE "accounts" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "user_id" uuid NOT NULL, "type" text NOT NULL, "provider" text NOT NULL, "provider_account_id" 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 CREATE TABLE "sessions" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "session_token" text NOT NULL, "user_id" uuid NOT NULL, "expires" timestamp NOT NULL, CONSTRAINT "sessions_session_token_unique" UNIQUE("session_token") ); --> statement-breakpoint CREATE TABLE "user_activities" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "user_id" uuid NOT NULL, "type" text NOT NULL, "description" text NOT NULL, "credit_amount" integer, "metadata" text, "created_at" timestamp DEFAULT now() ); --> statement-breakpoint CREATE TABLE "users" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "email" text NOT NULL, "password" text, "username" text, "email_verified" timestamp, "image" text, "is_email_verified" boolean DEFAULT false NOT NULL, "credits" integer DEFAULT 10 NOT NULL, "created_at" timestamp DEFAULT now(), "updated_at" timestamp DEFAULT now(), CONSTRAINT "users_email_unique" UNIQUE("email") ); --> statement-breakpoint CREATE TABLE "verification_tokens" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "email" text NOT NULL, "token" text NOT NULL, "expires" timestamp NOT NULL, "type" text NOT NULL, "created_at" timestamp DEFAULT now(), CONSTRAINT "verification_tokens_token_unique" UNIQUE("token") ); --> statement-breakpoint ALTER TABLE "accounts" ADD CONSTRAINT "accounts_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "sessions" ADD CONSTRAINT "sessions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "user_activities" ADD CONSTRAINT "user_activities_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;