Report hasn't been filed before.
What version of drizzle-orm are you using?
1.0.0-beta.22
What version of drizzle-kit are you using?
1.0.0-beta.22
Other packages
drizzle-seed@1.0.0-beta.22
Describe the Bug
seed() throws when a table declares two composite unique constraints that share a column. This is a common multi-tenant pattern: a (tenant_id, id) composite unique to serve as a composite-FK target, plus a (tenant_id, business_key) unique for the per-tenant business rule. PostgreSQL supports this without issue, but drizzle-seed rejects it.
Error
Error: Currently, multiple composite unique keys that share the same column are not supported.
at SeedService.generatePossibleGenerators (drizzle-seed/src/SeedService.ts:359)
at seedPostgres (drizzle-seed/src/pg-core/index.ts:63)
at seedFunc (drizzle-seed/src/index.ts:347)
...
Minimal reproduction
import { pgTable, uuid, text, unique } from "drizzle-orm/pg-core";
import { drizzle } from "drizzle-orm/postgres-js";
import { seed } from "drizzle-seed";
import postgres from "postgres";
const products = pgTable(
"products",
{
id: uuid("id").primaryKey().defaultRandom(),
orgId: uuid("org_id").notNull(),
name: text("name").notNull(),
},
(t) => [
// composite-FK target so children can enforce same-tenant references
unique("products_org_id_unique").on(t.orgId, t.id),
// per-tenant business uniqueness
unique("products_org_name_unique").on(t.orgId, t.name),
],
);
const db = drizzle(postgres(process.env.DATABASE_URL!));
await seed(db, { products }); // throws
Expected behavior
drizzle-seed should generate rows that satisfy both composite unique constraints (both constraints are independently valid in PostgreSQL), rather than throwing.
Actual behavior
generatePossibleGenerators throws unconditionally as soon as two composite unique constraints share a column. Providing explicit generators via .refine() for the columns involved does not help — the check is structural and runs before generators are applied.
Report hasn't been filed before.
What version of
drizzle-ormare you using?1.0.0-beta.22
What version of
drizzle-kitare you using?1.0.0-beta.22
Other packages
drizzle-seed@1.0.0-beta.22
Describe the Bug
seed()throws when a table declares two composite unique constraints that share a column. This is a common multi-tenant pattern: a(tenant_id, id)composite unique to serve as a composite-FK target, plus a(tenant_id, business_key)unique for the per-tenant business rule.PostgreSQLsupports this without issue, butdrizzle-seedrejects it.Error
Minimal reproduction
Expected behavior
drizzle-seedshould generate rows that satisfy both composite unique constraints (both constraints are independently valid in PostgreSQL), rather than throwing.Actual behavior
generatePossibleGeneratorsthrows unconditionally as soon as two composite unique constraints share a column. Providing explicit generators via.refine()for the columns involved does not help — the check is structural and runs before generators are applied.