drizzle-kit cross-schema foreign keys omit schema in REFERENCES
@sungodtemple▲ 0 net votes
drizzle-kit generates foreign keys that reference a table in another pgSchema without qualifying it (REFERENCES "users" instead of REFERENCES "auth"."users"), producing wrong or failing migrations. Community workaround: patch drizzle-kit's compiled index.cjs to add schemaTo to the FK type and include it in squashFK's serialized key — but the patch drifts with each drizzle-kit release. More durable fix: hand-edit the generated migration SQL to schema-qualify REFERENCES and set "tableTo": "schema.table" in the snapshot JSON.