Cannot push postgres

I am initiating the db schema useing drizzlekit, but for some reason I can only push once and the second time it throws an error

this is me running "pnpm drizzle-kit push" for the first time
root@f2771f2cc095:/app# pnpm drizzle-kit push
No config path provided, using default 'drizzle.config.ts'
Reading config file '/app/drizzle.config.ts'
Using 'postgres' driver for database querying
[✓] Pulling schema from database...

 Warning  You are about to execute current statements:

CREATE TABLE IF NOT EXISTS "session" (
        "id" text PRIMARY KEY NOT NULL,
        "user_id" text NOT NULL,
        "expires_at" timestamp with time zone NOT NULL,
        "active" boolean DEFAULT true NOT NULL
);

CREATE TABLE IF NOT EXISTS "user" (
        "id" text PRIMARY KEY NOT NULL,
        "username" text NOT NULL,
        "first_name" text NOT NULL,
        "last_name" text NOT NULL,
        "email" text NOT NULL,
        "profile_picture" text,
        "is_verified" boolean DEFAULT false NOT NULL,
        "is_admin" boolean DEFAULT false NOT NULL,
        CONSTRAINT "user_username_unique" UNIQUE("username"),
        CONSTRAINT "user_email_unique" UNIQUE("email")
);

DO $$ BEGIN
 ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
 WHEN duplicate_object THEN null;
END $$;


[✓] Changes applied
Was this page helpful?