Skip to content

Commit 7a154b2

Browse files
committed
Added default value null check for mapping generation
1 parent f677715 commit 7a154b2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Classes/DbScriptExtensions_Database.ext

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,15 @@ function Database:GetTableInformations()
133133
obj.isPrimaryKey = true
134134
end
135135
obj.defaultValue = columnTypeFunctions[dataType]()(query, 4)
136-
if (type(obj.defaultValue) == "string") then
136+
if (obj.defaultValue == nil) then
137+
if (columnTypeFunctions[dataType]() == ColumnType.String) then
138+
obj.defaultValue = "\"\""
139+
elseif (columnTypeFunctions[dataType]() == ColumnType.Bool) then
140+
obj.defaultValue = "false"
141+
else
142+
obj.defaultValue = 0
143+
end
144+
elseif (type(obj.defaultValue) == "string") then
137145
obj.defaultValue = "\""..obj.defaultValue.."\""
138146
end
139147
table.insert(columns, obj)

0 commit comments

Comments
 (0)