Skip to content

Commit 412d1c2

Browse files
committed
Allow overwriting default not_null=true for geom columns
By setting not_null=false
1 parent bffa25c commit 412d1c2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lua/themepark.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,21 +346,25 @@ function themepark:add_table(data)
346346
end
347347

348348
if data.geom then
349+
local not_null = true
349350
if type(data.geom) == 'string' then
350351
data.geom_type = data.geom
351352
data.geom_column = 'geom'
352353
data.geom = nil
353354
elseif type(data.geom) == 'table' then
354355
data.geom_type = data.geom.type
355356
data.geom_column = data.geom.column
357+
if data.geom.not_null == false then
358+
not_null = false
359+
end
356360
data.geom = nil
357361
end
358362
table.insert(data.columns, 1, {
359363
column = data.geom_column,
360364
type = data.geom_type,
361365
projection = self.options.srid,
362366
expire = data.expire,
363-
not_null = true
367+
not_null = not_null
364368
})
365369
table.insert(data.indexes, {
366370
column = data.geom_column,

0 commit comments

Comments
 (0)