pg-schema-print-types tries to generate a new brand for a many-to-many relation table
juho opened this issue · 1 comments
juho commented
I have this table:
CREATE TABLE IF NOT EXISTS public.user_permission (
user_id uuid NOT NULL,
account_id uuid NOT NULL,
feature VARCHAR(32) NOT NULL,
PRIMARY KEY (account_id, user_id, feature),
FOREIGN KEY (user_id) REFERENCES public.user(id) ON DELETE CASCADE,
FOREIGN KEY (account_id) REFERENCES public.account(id) ON DELETE CASCADE
);
pg-schema-print-types generates:
import Account from './account'
/**
* User permissions
*/
interface UserPermission {
account_id: Account['id']
feature: string & {readonly __brand?: 'user_permission_feature'}
user_id: string & {readonly __brand?: 'user_permission_user_id'}
}
export default UserPermission;
Should it not also generate the reference to User['id']
instead of a new brand? If I remove the primary key constraint it works.
ForbesLindesay commented
Thank you for reporting this. It should be resolved by #250