Creating composite types in PostgreSQL

Hi, I'm curious how I could recreate the following code using drizzle.
-- composite type
CREATE TYPE author AS (
    name text,
    role text
);

CREATE TABLE books (
    book_id serial PRIMARY KEY,
    title text,
    authors author[]
);


Is it simply
type Author = {
    name: string;
    role: string;
};

const books = pgTable('books', {
    bookId: serial('book_id').primaryKey(),
    title: text('title'),
    authors: text('authors').array().$type<Author>(),
});


Because I ran \dT and it didn't show a custom type for the Author in postgres
Was this page helpful?