The default generateIdentifierType generates Identifiers like this:
/** Identifier type for Product */
export type ProductId = number & { __brand: 'ProductId' };
When using multiple schemas, it's is possible that two schemas will contain tables with the same name. To make the Identifier more strict, it probably should include the schema name as well.
Such as:
/** Identifier type for Public.Product */
export type ProductId = number & { __brand: 'Public.ProductId ' };
I worked around this issue by implementing a custom generateIdentifierType function like so:
// In `term_life/Product.ts`
/** Identifier type for term_life.product */
export type ProductId = number & { __flavor?: 'term_life.product.id' };
// In `income_protection/Product.ts`
/** Identifier type for income_protection.product */
export type ProductId = number & { __flavor?: 'income_protection.product.id' };
The default
generateIdentifierType
generates Identifiers like this:When using multiple schemas, it's is possible that two schemas will contain tables with the same name. To make the Identifier more strict, it probably should include the schema name as well.
Such as:
I worked around this issue by implementing a custom
generateIdentifierType
function like so:This creates something like this: