Possible bug?
type UserID = number;
type Data = {
foo: string,
bar: number,
face: boolean,
};
export const usersWithBrand = pgTable('users_with_brand', {
id: t.integer().primaryKey().generatedByDefaultAsIdentity().$type<UserID>(),
data: t.jsonb().$type<Data>(),
updateCounter: t.integer().default(sql
1
).$onUpdateFn((): SQL => sql${usersWithBrand.updateCounter} + 1
),
updatedAt: t.timestamp({ mode: 'date', precision: 3 }).$onUpdate(() => new Date()),
alwaysNull: t.text().$type<string | null>().$onUpdate(() => null),
});
Every drizzle-kit push will be sending out
ALTER TABLE "users_with_brand" ALTER COLUMN "update_counter" SET DEFAULT 1;1 Reply
I think it might be related to snake_case
export const db = drizzle(process.env.DATABASE_URL, { casing: 'snake_case', logger: true });