nu
nu
DTDrizzle Team
Created by nu on 12/7/2024 in #help
How to add comment on postgres table columns (and other one-time operations like add trigger)
I want to add comment on columns of my postgres table (COMMENT ON COLUMN). There is no native function in drizzle. I can see suggestions like
export default {
async up(db) {
await db.execute(sql`COMMENT ON COLUMN users.username IS 'User\'s unique username';`);
await db.execute(sql`COMMENT ON COLUMN users.email IS 'User\'s email address';`);
},
export default {
async up(db) {
await db.execute(sql`COMMENT ON COLUMN users.username IS 'User\'s unique username';`);
await db.execute(sql`COMMENT ON COLUMN users.email IS 'User\'s email address';`);
},
But won't this be executed every time? I faced same doubt when trying to add trigger+function.
4 replies