Skip to content

Commit a5cdbf2

Browse files
committed
don't write default schema on table name
1 parent a913b29 commit a5cdbf2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lapis/cmd/actions/annotate.lua

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ exec = function(cmd)
1313
return _with_0
1414
end
1515
end
16+
local DEFAULT_SCHEMA = "public"
1617
local extract_header
1718
extract_header = function(config, model)
1819
local table_name = model:table_name()
@@ -73,6 +74,7 @@ extract_header = function(config, model)
7374
_continue_0 = true
7475
break
7576
end
77+
line = line:gsub(tostring(DEFAULT_SCHEMA) .. "%." .. tostring(table_name), table_name)
7678
if line:match("^ALTER TABLE") and not line:match("^ALTER TABLE ONLY") or line:match("nextval") then
7779
_continue_0 = true
7880
break

lapis/cmd/actions/annotate.moon

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ exec = (cmd) ->
88
with f\read("*all")\gsub "%s*$", ""
99
f\close!
1010
11+
DEFAULT_SCHEMA = "public"
12+
1113
extract_header = (config, model) ->
1214
table_name = model\table_name!
1315
database = assert config.postgres.database, "missing db"
@@ -42,6 +44,8 @@ extract_header = (config, model) ->
4244
continue if line\match "^ALTER SEQUENCE"
4345
continue if line\match "^SELECT"
4446

47+
line = line\gsub "#{DEFAULT_SCHEMA}%.#{table_name}", table_name
48+
4549
if line\match("^ALTER TABLE" ) and not line\match("^ALTER TABLE ONLY") or line\match "nextval"
4650
continue
4751

0 commit comments

Comments
 (0)