Fix warnings with schema Sync2 with default varchar as NVARCHAR #1783

Merged
lunny merged 22 commits from zeripath/xorm:fix-1782-MSSQL-nvarchar-fixes into master 2020-09-08 01:40:09 +00:00
Showing only changes of commit 5729222a0e - Show all commits

View File

@ -857,10 +857,8 @@ func (db *postgres) SQLType(c *schemas.Column) string {
res = schemas.Real
case schemas.TinyText, schemas.MediumText, schemas.LongText:
res = schemas.Text
case schemas.Char:
res = schemas.Varchar
case schemas.NChar:
zeripath marked this conversation as resolved
Review

I don't think we should convert Char to Varchar since postgres support CHAR type. We just need

case schemas.NChar:
    res = schemas.Char
I don't think we should convert Char to Varchar since postgres support `CHAR` type. We just need ``` case schemas.NChar: res = schemas.Char ```
res = schemas.Varchar
res = schemas.Char
case schemas.NVarchar:
res = schemas.Varchar
case schemas.Uuid:
@ -1090,8 +1088,10 @@ WHERE n.nspname= s.table_schema AND c.relkind = 'r'::char AND c.relname = $1%s A
col.Nullable = (isNullable == "YES")
switch strings.ToLower(dataType) {
case "character varying", "character", "string":
case "character varying", "string":
col.SQLType = schemas.SQLType{Name: schemas.Varchar, DefaultLength: 0, DefaultLength2: 0}
case "character":
col.SQLType = schemas.SQLType{Name: schemas.Char, DefaultLength: 0, DefaultLength2: 0}
case "timestamp without time zone":
col.SQLType = schemas.SQLType{Name: schemas.DateTime, DefaultLength: 0, DefaultLength2: 0}
case "timestamp with time zone":