dmfay / massive-js

A data mapper for Node.js and PostgreSQL.
2.49k stars 158 forks source link

Ability to add comments to fields easily #534

Closed flux627 closed 6 years ago

flux627 commented 6 years ago

Something I never liked about native Postgres SQL migrations was the decoupling between adding columns and their comments. It would be nice to do something like this:

exports.up = (pgm) => {
  pgm.createTable( "my_table", {
    id: {
      type: "uuid",
      primaryKey: true,
    },
    created_at: {
      type: "timestamp",
      notNull: true,
      default: new PgLiteral("current_timestamp"),
      comment: "Time this entry was created."
    },
    username: {
      type: "string"
      unique: true,
      comment: "Unique identifier for user."
    }
  })
}

Which would automatically add the respective COMMENT ON COLUMN ... after creating the table.

dmfay commented 6 years ago

Massive isn't a migration framework and doesn't create tables (other than well-defined document tables... which could probably use column comments, to be fair). Did you mean to file this against node-pg-migrate?

flux627 commented 6 years ago

Yes, I did. Sorry, had both tabs open!