Add attribute default to the column on create or alter commands. Skip columns which are keys and date or time data type

This commit is contained in:
supar
2014-11-06 16:01:22 +03:00
parent 07c628c7e9
commit 1a1b0c14b9
2 changed files with 55 additions and 1 deletions

View File

@@ -116,6 +116,7 @@ type fieldInfo struct {
null bool
index bool
unique bool
colDefault bool
initial StrTo
size int
auto_now bool
@@ -280,6 +281,11 @@ checkType:
fi.pk = attrs["pk"]
fi.unique = attrs["unique"]
// Mark object property if there is attribute "default" in the orm configuration
if _, ok := tags["default"]; ok {
fi.colDefault = true
}
switch fieldType {
case RelManyToMany, RelReverseMany, RelReverseOne:
fi.null = false