Exposed icon indicating copy to clipboard operation
Exposed copied to clipboard

Can be support table and column comment?

Open wittyneko opened this issue 2 years ago • 1 comments

In MySQL use comment to add comments.

CREATE TABLE Users(
  id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT 'user id'
) COMMENT='user info'

Can you support it like this.

object Users : Table() {
    val id = long("id")
        .autoIncrement()
        .comment("user id")
    override val primaryKey = PrimaryKey(id)
    override val tableComment = "user info"
}

wittyneko avatar Apr 02 '23 16:04 wittyneko

It's an interesting requirement, but I think it may require more discussion about the correct design, because MySQL is a bit of an exception on how it approaches comments.

For example, PosgreSQL uses COMMENT statement that is separate from the table definition:

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

And Oracle uses similar approach to PostgreSQL, but with less options: https://docs.oracle.com/cd/B12037_01/server.101/b10759/statements_4009.htm

AlexeySoshin avatar Apr 08 '23 19:04 AlexeySoshin

Starting with version 0.52.0, column comments in MySQL, MariaDB, H2, and SQLite will be available using:

object Users : Table("users") {
    val id = long("id")
        .autoIncrement()
        .withDefinition("COMMENT", stringLiteral("user id"))

    override val primaryKey = PrimaryKey(id)
}

Table comments (or column comments via separate COMMENT ON COLUMN) are still not supported. Please see EXPOSED-418 to bump/track this feature request.

bog-walk avatar Jun 18 '24 15:06 bog-walk