Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I find the format of code that comes from tools deriving CREATEs from live databases to be totally acceptable, usually. Then again I'm the kind of person who prefers team-wide auto-formatting and a strict style linter, so maybe that's just me.

> If you maintain your schema like source code, you can use comments, organise it into files in a way that makes sense to you, maybe do a bit of light templating, and so on.

As usual—for the comments part, at least—PostgreSQL has your back.

https://www.postgresql.org/docs/9.1/sql-comment.html



I use SQL-level COMMENTs and comments in the schema source for different things.

The former can be made visible to people using the database; the latter are for people maintaining the schema.

In any case, I don't think I'd get on with an auto-formatter that thought « COMMENT ON TABLE foo IS » was a friendly comment-introducing string. « -- » takes up rather less space.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: