Skip to content

Commit

Permalink
Moved uuid-ossp extension setup to IHP from the app specific Schema.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed Aug 24, 2020
1 parent 8d2ee51 commit 303aec7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions lib/IHP/IHPSchema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Provides all the default settings for a IHP database in development mode
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
17 changes: 11 additions & 6 deletions lib/IHP/Makefile.dist
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ PROD_GHC_OPTIONS+= -with-rtsopts="-A512m -n4m"
.DEFAULT_GOAL := help
RUNGHC=runghc

ifneq ($(wildcard IHP/.*),)
IHP_LIB = IHP/lib/IHP
else
IHP_LIB = $(shell dirname $$(which RunDevServer))/../lib/IHP
endif

all: build/ihp-lib build/Generated/Types.hs

.envrc: default.nix ## Rebuild nix packages and .envrc
Expand All @@ -97,6 +103,7 @@ psql: ## Connects to the running postgresql server

db: Application/Schema.sql Application/Fixtures.sql ## Creates a new database with the current Schema and imports Fixtures.sql
echo "drop schema public cascade; create schema public;" | psql -h $$PWD/build/db -d app
psql -h $$PWD/build/db -d app < "${IHP_LIB}/IHPSchema.sql"
psql -h $$PWD/build/db -d app < Application/Schema.sql
psql -h $$PWD/build/db -d app < Application/Fixtures.sql

Expand Down Expand Up @@ -143,13 +150,11 @@ print-ghc-extensions: ## Prints all used ghc extensions. Useful for scripting
help: ## This help page
@grep -h -E '^[a-zA-Z_///-\.]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

ifneq ($(wildcard IHP/.*),)
IHP_LIB = ../IHP/lib/IHP
else
IHP_LIB = $(shell dirname $$(which RunDevServer))/../lib/IHP
endif

build/ihp-lib: # Used by application .ghci
mkdir -p build
rm -f build/ihp-lib
ifneq ($(wildcard IHP/.*),)
ln -s ../IHP/lib/IHP build/ihp-lib
else
ln -s ${IHP_LIB} build/ihp-lib
endif

0 comments on commit 303aec7

Please sign in to comment.