Can i use "uniqueIndex" for that?

Hi, I was just wondering if

export const contactToCompany = pgTable(
    "ContactToCompany",
    {

        contactId: integer().primaryKey()
        companyId: integer().primaryKey()
   
 },

    (t) => [
        index("ContactToCompany_contactId_companyId").on(
            t.contactId,
            t.companyId,
        ),
        unique("ContactToCompany_contactId_companyId_key").on(
            t.contactId,
            t.companyId,
        ),
    ],
);


can be

 (t) => [
        uniqueIndex("ContactToCompany_contactId_companyId").on(
            t.contactId,
            t.companyId,
        ),
    ],


Best regards, Tristan
Was this page helpful?