Skip to content

Commit

Permalink
Added default value null check for mapping generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaev committed Feb 3, 2022
1 parent f677715 commit 7a154b2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Classes/DbScriptExtensions_Database.ext
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,15 @@ function Database:GetTableInformations()
obj.isPrimaryKey = true
end
obj.defaultValue = columnTypeFunctions[dataType]()(query, 4)
if (type(obj.defaultValue) == "string") then
if (obj.defaultValue == nil) then
if (columnTypeFunctions[dataType]() == ColumnType.String) then
obj.defaultValue = "\"\""
elseif (columnTypeFunctions[dataType]() == ColumnType.Bool) then
obj.defaultValue = "false"
else
obj.defaultValue = 0
end
elseif (type(obj.defaultValue) == "string") then
obj.defaultValue = "\""..obj.defaultValue.."\""
end
table.insert(columns, obj)
Expand Down

0 comments on commit 7a154b2

Please sign in to comment.