Identifier is too long (should not exceed 63 characters)
Hello guys. I've got too long constraint id generated by drizzle kit in migration files. Is it safe to apply such migration? Maybe there is a way how I can set custom constraint id for some tables? Here is my schema
Here is the generated sql
export const customerVehicleClaims = pgTable('customer_vehicle_claims', {
claimsid: text('claimsid').primaryKey().notNull(),
customervehicleid: integer('customervehicleid')
.notNull()
.references(() => customervehicle.customervehicleid),
createdAt: timestamp('created_at', { mode: 'string' }).defaultNow().notNull(),
updatedAt: timestamp('updated_at', { mode: 'string' }),
customerid: integer('customerid')
.notNull()
.references(() => customer.customerid),
vehicleid: integer('vehicleid')
.notNull()
.references(() => vehicle.vehicleid),
});export const customerVehicleClaims = pgTable('customer_vehicle_claims', {
claimsid: text('claimsid').primaryKey().notNull(),
customervehicleid: integer('customervehicleid')
.notNull()
.references(() => customervehicle.customervehicleid),
createdAt: timestamp('created_at', { mode: 'string' }).defaultNow().notNull(),
updatedAt: timestamp('updated_at', { mode: 'string' }),
customerid: integer('customerid')
.notNull()
.references(() => customer.customerid),
vehicleid: integer('vehicleid')
.notNull()
.references(() => vehicle.vehicleid),
});Here is the generated sql
DO
$$
BEGIN
ALTER TABLE "customer_vehicle_claims"
ADD CONSTRAINT "customer_vehicle_claims_customervehicleid_customervehicle_customervehicleid_fk" FOREIGN KEY ("customervehicleid") REFERENCES "customervehicle" ("customervehicleid") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END
$$;
--> statement-breakpointDO
$$
BEGIN
ALTER TABLE "customer_vehicle_claims"
ADD CONSTRAINT "customer_vehicle_claims_customervehicleid_customervehicle_customervehicleid_fk" FOREIGN KEY ("customervehicleid") REFERENCES "customervehicle" ("customervehicleid") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END
$$;
--> statement-breakpoint