changelogs/drizzle-orm-pg/0.15.0.md
notNull to true in runtime, when .primaryKey() function was used in ColumnBuilderno action for OnDelete and OnUpdate in runtime by defaultindex('usersNameIdx') or index(). In last case, drizzle will generate index name automatically based on table and column index was created onforeignKey() function api changes. Previosuly you need to pass callback function with table columns for FK. Right now no need for callback, just object with data for FK
export const usersTable = pgTable(
'users_table',
{
id: serial('id').primaryKey(),
uuid: uuid('uuid').defaultRandom().notNull(),
homeCity: integer('home_city').notNull()
},
(users) => ({
// foreignKey had a callback as param
usersCityFK: foreignKey(() => ({ columns: [users.homeCity], foreignColumns: [cities.id] })),
}),
);
export const usersTable = pgTable(
'users_table',
{
id: serial('id').primaryKey(),
uuid: uuid('uuid').defaultRandom().notNull(),
homeCity: integer('home_city').notNull()
},
(users) => ({
// foreignKey doesn't have a callback as param
usersCityFK: foreignKey({ columns: [users.homeCity], foreignColumns: [cities.id] }),
}),
);