From cfcce4f5dcdcd7167eaa93a88f113370c90519f1 Mon Sep 17 00:00:00 2001 From: Pelle Johnsen Date: Tue, 22 Sep 2015 12:23:51 +0200 Subject: [PATCH] Fix handling of rel(fk) to model with string pk --- orm/cmd_utils.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/orm/cmd_utils.go b/orm/cmd_utils.go index 5b40fd07..bddada7c 100644 --- a/orm/cmd_utils.go +++ b/orm/cmd_utils.go @@ -45,13 +45,14 @@ func getDbDropSQL(al *alias) (sqls []string) { func getColumnTyp(al *alias, fi *fieldInfo) (col string) { T := al.DbBaser.DbTypes() fieldType := fi.fieldType + fieldSize := fi.size checkColumn: switch fieldType { case TypeBooleanField: col = T["bool"] case TypeCharField: - col = fmt.Sprintf(T["string"], fi.size) + col = fmt.Sprintf(T["string"], fieldSize) case TypeTextField: col = T["string-text"] case TypeDateField: @@ -89,6 +90,7 @@ checkColumn: } case RelForeignKey, RelOneToOne: fieldType = fi.relModelInfo.fields.pk.fieldType + fieldSize = fi.relModelInfo.fields.pk.size goto checkColumn }