Updating drizzle and want to make sure I 100% understand the changes

I started noticing in my schema.ts I was getting this warning
The signature '(name: "seasons", columns: { id: IsPrimaryKey<NotNull<PgSerialBuilderInitial<"id">>>; year: NotNull<PgIntegerBuilderInitial<"year">>; start: NotNull<...>; end: NotNull<...>; }, extraConfig: (self: { ...; }) => PgTableExtraConfig): PgTableWithColumns<...>' of 'pgTable' is deprecated. (ts 6387)
The signature '(name: "seasons", columns: { id: IsPrimaryKey<NotNull<PgSerialBuilderInitial<"id">>>; year: NotNull<PgIntegerBuilderInitial<"year">>; start: NotNull<...>; end: NotNull<...>; }, extraConfig: (self: { ...; }) => PgTableExtraConfig): PgTableWithColumns<...>' of 'pgTable' is deprecated. (ts 6387)
on something like
export const seasonsTable = pgTable(
'seasons',
{
id: serial('id').primaryKey(),
year: integer('year').notNull(),
start: timestamp('start').notNull(),
end: timestamp('end').notNull(),
},
(table) => ({
isUniqueSeason: unique().on(table.year),
}),
)
export const seasonsTable = pgTable(
'seasons',
{
id: serial('id').primaryKey(),
year: integer('year').notNull(),
start: timestamp('start').notNull(),
end: timestamp('end').notNull(),
},
(table) => ({
isUniqueSeason: unique().on(table.year),
}),
)
I believe I just need to change
(table) => ({
isUniqueSeason: unique().on(table.year),
}),
(table) => ({
isUniqueSeason: unique().on(table.year),
}),
to (table) => [unique().on(table.year)]
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?