add table & column comment for postgres(add table comment for mysql) #2067
Merged
lunny
merged 12 commits from fanybook/xorm:master
into master
9 months ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'fanybook/xorm:master'
Deleting a branch is permanent. It CANNOT be undone. Continue?
让 postgres 支持字段注释,只在 v1.2.5 上测试过(不知道怎么 import master)
发现 master 分支好像大改了?模式表名带 schema 了
使用方式和 mysql 相同
You should change
dialects/postgres.go
but not there.per my comment above.
@lunny 已经移到 dialects 了,感觉 master 代码和 v1.2.5 相差很多,接口都变了
现在支持了字段注释和表注释
我发现 dialects/mysql.go 貌似没有用到 schema?mysql 里的库也相当于 pgsql 里的 schema
add column comment for postgresto add table & column comment for postgres 9 months agoadd table & column comment for postgresto add table & column comment for postgres(add table comment for mysql) 9 months agoreturn nil, err
}
// if bean has Comment Method, then set table.Comment
This should be moved into
parser.Parse
Thank you very much! Could you add some tests here? I think we have some with comment for MySQL.
return v.Interface().(TableComment).TableComment()
}
return ""
You should also consider it's a pointer method.
if err = session.addColumn(col.Name); err != nil {
return err
}
unnecessary change.
return "p_parseTableName"
}
func (p ParseTableName2) TableComment() string {
Please also add a pointer method
How about also add simliar test cases for postgres?
parser.Parse only set table.Commet, it will be used in dialects
i don't know how to import master branch in my project
@lunny 看一下,能合并了么
modifyColumnSQL = fmt.Sprintf("ALTER TABLE %s.%s ALTER COLUMN %s TYPE %s", quoter.Quote(db.getSchema()), quoter.Quote(tableName), quoter.Quote(col.Name), db.SQLType(col))
commentSQL += fmt.Sprintf("COMMENT ON COLUMN %s.%s.%s IS '%s'", quoter.Quote(db.getSchema()), quoter.Quote(tableName), quoter.Quote(col.Name), col.Comment)
return modifyColumnSQL + commentSQL
need a space between two SQLs
@lunny has space and semicolon
I mean in function
ModifyColumnSQL
@lunny 我不太明白,应该在哪加空格,请指点一下
@lunny 受累看一下能合并了么,之前您说在 ModifyColumnSQL 里,两段 sql 之前应该有一个空格
但是在 commentSQL 初始化的时候,这个空格就已经有了,还有一个分号
like this
aea91cc7de
into master 9 months agoReviewers
aea91cc7de
.