Neon postgres, drop all fk constraints on every push without any changes

A new db and new migrations, but on the second push and forward drizzle drops and add again all the fk constraints of the schema. I've also made sure all of the fk names are within the 63 characters limit. I'm on: "drizzle-orm": "^0.30.4", "drizzle-kit": "^0.20.14", Example of the push statement: ALTER TABLE "company_users" DROP CONSTRAINT "company_users_company_id_companies_id_fk"; ALTER TABLE "main_account_users" DROP CONSTRAINT "main_account_users_user_id_users_id_fk"; ALTER TABLE "organization_users" DROP CONSTRAINT "organization_users_user_id_users_id_fk"; DO $$ BEGIN ALTER TABLE "company_users" ADD CONSTRAINT "company_users_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "companies"("id") ON DELETE cascade ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; DO $$ BEGIN ALTER TABLE "main_account_users" ADD CONSTRAINT "main_account_users_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE cascade ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; DO $$ BEGIN ALTER TABLE "organization_users" ADD CONSTRAINT "organization_users_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE cascade ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$;
2 Replies
zendev
zendev5mo ago
I have the same issue, did you ever figure out why this was happening?
dakdevs
dakdevs3mo ago
bumping this, im having this issue just using push locally...
Want results from more Discord servers?
Add your server