Skip to content

Commit

Permalink
Merge pull request #13 from ZeroGachis/fix_schema
Browse files Browse the repository at this point in the history
Fix schema
  • Loading branch information
rodo authored Dec 13, 2024
2 parents 2150879 + b7b30e0 commit 0db6e70
Show file tree
Hide file tree
Showing 21 changed files with 1,312 additions and 182 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
schedoc.control
*.zip
test/sql/*.sql
test/*.sql
test/*.sql
exclude.sql
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ INTETESTS = $(shell find test/ -type f -name '*.sql.in' | sed -e 's/.in$$//')

EXTENSION = schedoc

TOOLSEXC = $(wildcard tools_exclusion/*.sql)

EXTVERSION = $(shell grep -m 1 '[[:space:]]\{3\}"version":' META.json | \
sed -e 's/[[:space:]]*"version":[[:space:]]*"\([^"]*\)",\{0,1\}/\1/')

Expand All @@ -29,24 +31,31 @@ include $(PGXS)
all: $(DIST) $(PGTLEOUT) $(EXTENSION).control $(UNITTESTS) $(INTETESTS)

clean:
rm -f $(PGTLEOUT) $(DIST) $(UNITTESTS)
rm -f $(PGTLEOUT) $(DIST) $(UNITTESTS) exclude.sql

$(DIST): $(FILES)
$(DIST): $(FILES) exclude.sql
cat sql/table.sql > $@
cat sql/management.sql >> $@
cat sql/function.sql >> $@
cat sql/function-stop.sql >> $@
cat sql/function-status.sql >> $@
cat sql/view.sql >> $@
cat exclude.sql >> $@
cat sql/start.sql >> $@
cat $@ > dist/$(EXTENSION).sql

test:
exclude.sql: $(TOOLSEXC)
cat $(TOOLSEXC) > exclude.sql

test: $(UNITTESTS) $(INTETESTS)
pg_prove -f test/sql/*.sql

test/sql/%.sql: test/sql/%.sql.in
sed 's,_TEST_SCHEMA_,$(TEST_SCHEMA),g; ' $< > $@

test/%.sql: test/%.sql.in
sed 's,_TEST_SCHEMA_,$(TEST_SCHEMA),g; ' $< > $@
echo "--\n-- Auto generated file DO NOT EDIT !!" > $@
sed 's,_TEST_SCHEMA_,$(TEST_SCHEMA),g; ' $< >> $@

$(PGTLEOUT): dist/$(EXTENSION)--$(EXTVERSION).sql pgtle_header.in pgtle_footer.in
sed -e 's/_EXTVERSION_/$(EXTVERSION)/' pgtle_header.in > $(PGTLEOUT)
Expand Down
Loading

0 comments on commit 0db6e70

Please sign in to comment.