tomspoint
DTDrizzle Team
•Created by tomspoint on 5/5/2023 in #help
define default value for array
I work with a PostgreSQL database.
Here is my Schema:
export const user = pgTable(
'auth_user',
{
id: uuid('id').primaryKey(),
email: text('email').notNull(),
roles: text('roles').array().default(['registered'])
},
(table) => {
return {
email: uniqueIndex('auth_user_email').on(table.email)
};
}
);
I have a problem with this line:
roles: text('roles').array().default(['registered']) How do I define the default value to be ['registered'] ?
roles: text('roles').array().default(['registered']) How do I define the default value to be ['registered'] ?
11 replies