© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago•
21 replies
MahmoodKhalil

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
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
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

postgres push issue
Drizzle TeamDTDrizzle Team / help
3y ago
cannot push
Drizzle TeamDTDrizzle Team / help
3y ago
Cannot use inArray in postgres.
Drizzle TeamDTDrizzle Team / help
14mo ago
instanceof postgres.PostgresError not working
Drizzle TeamDTDrizzle Team / help
9mo ago