From b20df7fbd294aac6c39e16e7d1349e420cadf928 Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Sat, 27 Oct 2018 14:54:35 +0200 Subject: [PATCH 01/19] Drop user before reinstall --- sql/sqlflow-structure.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/sqlflow-structure.sql b/sql/sqlflow-structure.sql index bd424a2..3dfd466 100644 --- a/sql/sqlflow-structure.sql +++ b/sql/sqlflow-structure.sql @@ -6,6 +6,7 @@ -- -- Add user to manage sqlflow object s in database -- +DROP ROLE IF EXISTS sqlflow; CREATE ROLE sqlflow WITH NOLOGIN NOSUPERUSER From 67c3622d09c02f9089b3ac0ea60e59e317abaedc Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Sat, 27 Oct 2018 15:32:53 +0200 Subject: [PATCH 02/19] Add structure for pg_regress --- test/sql/base.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 test/sql/base.sql diff --git a/test/sql/base.sql b/test/sql/base.sql new file mode 100644 index 0000000..eec1cdc --- /dev/null +++ b/test/sql/base.sql @@ -0,0 +1,6 @@ +\set ECHO none +BEGIN; + +SELECT 1; + +ROLLBACK; From 4a5f5e4070cf3120e194ae174d1a94d23e289224 Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Sat, 27 Oct 2018 15:33:53 +0200 Subject: [PATCH 03/19] Use pg_regress in travis --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 2713e4b..13432eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,8 +49,11 @@ install: script: - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-structure.sql -U postgres myflow - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-instance.sql -U postgres myflow + - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-functions.sql -U postgres myflow + - pg_regress --inputdir=test --load-language=plpgsql --dbname=myflow after_success: - echo "Success OK" - psql -f ./sql/uninstall_sqlflow.sql -U postgres myflow + - if test -f regression.diffs; then cat regression.diffs; fi From 13c7c7fb259823789b8dbdd6c83feb1ecb607ec9 Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Sat, 27 Oct 2018 15:34:27 +0200 Subject: [PATCH 04/19] Add functions --- sql/sqlflow-functions.sql | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 sql/sqlflow-functions.sql diff --git a/sql/sqlflow-functions.sql b/sql/sqlflow-functions.sql new file mode 100644 index 0000000..dbc664c --- /dev/null +++ b/sql/sqlflow-functions.sql @@ -0,0 +1,31 @@ +/* +function: GET_WORKFLOW_ID() +argument: 1> a_ref: the unique reference of the workflow +return: Primary key of the workflow +*/ +CREATE OR REPLACE FUNCTION get_workflow_id( + a_ref CHARACTER VARYING(36) +) RETURNS integer AS +$BODY$ + +DECLARE + t_workflow_id INTEGER DEFAULT NULL; +BEGIN + + BEGIN + SELECT id INTO STRICT t_workflow_id + FROM sqlflow.workflow + WHERE uref=a_ref; + EXCEPTION + WHEN NO_DATA_FOUND THEN + RAISE EXCEPTION 'Workflow "%" not found', a_ref; + WHEN TOO_MANY_ROWS THEN + RAISE EXCEPTION 'Workflow "%" not unique', a_ref; + END; + + RETURN t_workflow_id; + +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE; + From 09b1660b217736c6e2a008d78f62de98a943438e Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Sat, 27 Oct 2018 15:42:47 +0200 Subject: [PATCH 05/19] Use makefile for pg_regress --- .travis.yml | 2 +- Makefile | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 Makefile diff --git a/.travis.yml b/.travis.yml index 13432eb..6eeac44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ script: - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-structure.sql -U postgres myflow - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-instance.sql -U postgres myflow - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-functions.sql -U postgres myflow - - pg_regress --inputdir=test --load-language=plpgsql --dbname=myflow + - make check after_success: - echo "Success OK" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..740e11a --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +TESTS = $(wildcard test/sql/*.sql) +REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS)) +REGRESS_OPTS = --inputdir=test --load-language=plpgsql +PG_CONFIG ?= pg_config +PG92 = $(shell $(PG_CONFIG) --version | grep -qE " 8\.| 9\.0| 9\.1" && echo no || echo yes) + +ifeq ($(PG92),no) +$(error $(EXTENSION) requires PostgreSQL 9.2 or higher) +endif + +PGXS := $(shell $(PG_CONFIG) --pgxs) +include $(PGXS) From a66e69d1179af5aa990054a4dd2043544112faaa Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Sun, 28 Oct 2018 19:41:45 +0100 Subject: [PATCH 06/19] Another try --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6eeac44..a69f0d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ script: - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-structure.sql -U postgres myflow - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-instance.sql -U postgres myflow - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-functions.sql -U postgres myflow - - make check + - ls -l /usr/lib/postgresql/$PGVERSION/lib/pgxs/src/test/regress/ after_success: - echo "Success OK" From a63f095dd07b6a8136832bb0316bb60d12500b71 Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Sun, 28 Oct 2018 19:47:29 +0100 Subject: [PATCH 07/19] Another try --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a69f0d8..8795140 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ script: - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-structure.sql -U postgres myflow - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-instance.sql -U postgres myflow - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-functions.sql -U postgres myflow - - ls -l /usr/lib/postgresql/$PGVERSION/lib/pgxs/src/test/regress/ + - /usr/lib/postgresql/$PGVERSION/lib/pgxs/src/test/regress/pg_regress --help after_success: - echo "Success OK" From a43cfc46f2aa893d745ac508720f8cbab8fa0798 Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Mon, 29 Oct 2018 06:46:14 +0100 Subject: [PATCH 08/19] Another try --- .travis.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8795140..bab222a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,6 +34,7 @@ before_script: - psql -c 'CREATE DATABASE myflow WITH OWNER myflow;' -U postgres env: + - DBFLOW=myflow matrix: - PGVERSION=9.4 - PGVERSION=9.5 @@ -47,13 +48,13 @@ install: - echo "Install OK" script: - - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-structure.sql -U postgres myflow - - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-instance.sql -U postgres myflow - - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-functions.sql -U postgres myflow + - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-structure.sql -U postgres $DBFLOW + - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-instance.sql -U postgres $DBFLOW + - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-functions.sql -U postgres $DBFLOW - /usr/lib/postgresql/$PGVERSION/lib/pgxs/src/test/regress/pg_regress --help after_success: - echo "Success OK" - - psql -f ./sql/uninstall_sqlflow.sql -U postgres myflow + - psql -f ./sql/uninstall_sqlflow.sql -U postgres $DBFLOW - if test -f regression.diffs; then cat regression.diffs; fi From f3b5d196f29f883155d70eb237f1025d4a301ebc Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Fri, 9 Nov 2018 13:38:27 +0100 Subject: [PATCH 09/19] Add pgtap --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index bab222a..4e51d80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,7 @@ before_script: - createuser -U postgres -s travis - psql -c "CREATE USER myflow WITH PASSWORD 'myflow';" -U postgres - psql -c 'CREATE DATABASE myflow WITH OWNER myflow;' -U postgres + - psql -c 'CREATE EXTENSION pgtap;' -U postgres -d $DBFLOW env: - DBFLOW=myflow From 979028d8a576706feb2d48fe1031357d2c64b02e Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Fri, 9 Nov 2018 13:59:01 +0100 Subject: [PATCH 10/19] Fix broekn yaml --- .travis.yml | 69 ++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4e51d80..43e23ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,32 +10,9 @@ addons: packages: - expect-dev # provides unbuffer utility -before_install: - - psql --version - - sudo /etc/init.d/postgresql stop - - sudo apt-get -y --purge remove postgresql libpq-dev libpq5 postgresql-client-common postgresql-common - - sudo rm -rf /var/lib/postgresql - - wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - - - sudo sh -c "echo deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main $PGVERSION >> /etc/apt/sources.list.d/postgresql.list" - - sudo sh -c "echo deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg-testing main $PGVERSION >> /etc/apt/sources.list.d/postgresql.list" - - sudo apt-get update -qq - - sudo apt-get -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::="--force-confnew" install postgresql-$PGVERSION postgresql-server-dev-$PGVERSION - - sudo chmod 777 /etc/postgresql/$PGVERSION/main/pg_hba.conf - - sudo echo "local all postgres trust" > /etc/postgresql/$PGVERSION/main/pg_hba.conf - - sudo echo "local all all trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf - - sudo echo "host all all 128.0.0.1/32 trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf - - sudo echo "host all all ::1/128 trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf - - sudo /etc/init.d/postgresql restart - - psql --version - -before_script: - - createuser -U postgres -s travis - - psql -c "CREATE USER myflow WITH PASSWORD 'myflow';" -U postgres - - psql -c 'CREATE DATABASE myflow WITH OWNER myflow;' -U postgres - - psql -c 'CREATE EXTENSION pgtap;' -U postgres -d $DBFLOW - env: - - DBFLOW=myflow + global: + - DBFLOW=myflow matrix: - PGVERSION=9.4 - PGVERSION=9.5 @@ -43,19 +20,41 @@ env: - PGVERSION=10 - PGVERSION=11 +before_install: + - psql --version + - sudo /etc/init.d/postgresql stop + - sudo apt-get -y --purge remove postgresql libpq-dev libpq5 postgresql-client-common postgresql-common + - sudo rm -rf /var/lib/postgresql + - wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - + - sudo sh -c "echo deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main $PGVERSION >> /etc/apt/sources.list.d/postgresql.list" + - sudo sh -c "echo deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg-testing main $PGVERSION >> /etc/apt/sources.list.d/postgresql.list" + - sudo apt-get update -qq + - sudo apt-get -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::="--force-confnew" install postgresql-$PGVERSION postgresql-server-dev-$PGVERSION + - sudo chmod 777 /etc/postgresql/$PGVERSION/main/pg_hba.conf + - sudo echo "local all postgres trust" > /etc/postgresql/$PGVERSION/main/pg_hba.conf + - sudo echo "local all all trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf + - sudo echo "host all all 128.0.0.1/32 trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf + - sudo echo "host all all ::1/128 trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf + - sudo /etc/init.d/postgresql restart + - psql --version + +before_script: + - createuser -U postgres -s travis + - psql -c "CREATE USER myflow WITH PASSWORD 'myflow';" -U postgres + - psql -c 'CREATE DATABASE myflow WITH OWNER myflow;' -U postgres + - psql -c 'CREATE EXTENSION pgtap;' -U postgres -d $DBFLOW + install: - - git clone https://github.com/sql-flow/pg-extension.git $HOME/pg-extension - - export PATH=$HOME/pg-extension/scripts:$PATH - - echo "Install OK" + - git clone https://github.com/sql-flow/pg-extension.git $HOME/pg-extension + - export PATH=$HOME/pg-extension/scripts:$PATH + - echo "Install OK" script: - - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-structure.sql -U postgres $DBFLOW - - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-instance.sql -U postgres $DBFLOW - - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-functions.sql -U postgres $DBFLOW - - /usr/lib/postgresql/$PGVERSION/lib/pgxs/src/test/regress/pg_regress --help + - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-structure.sql -U postgres $DBFLOW + - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-instance.sql -U postgres $DBFLOW + - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-functions.sql -U postgres $DBFLOW after_success: - - echo "Success OK" - - psql -f ./sql/uninstall_sqlflow.sql -U postgres $DBFLOW - - if test -f regression.diffs; then cat regression.diffs; fi + - echo "Success OK" + - psql -f ./sql/uninstall_sqlflow.sql -U postgres $DBFLOW From 47800eeca749058845ae5ab7ba9877d5d74a74ff Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Fri, 9 Nov 2018 14:06:01 +0100 Subject: [PATCH 11/19] Add pgtap extension --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 43e23ea..8e0094e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ before_install: - sudo sh -c "echo deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main $PGVERSION >> /etc/apt/sources.list.d/postgresql.list" - sudo sh -c "echo deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg-testing main $PGVERSION >> /etc/apt/sources.list.d/postgresql.list" - sudo apt-get update -qq - - sudo apt-get -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::="--force-confnew" install postgresql-$PGVERSION postgresql-server-dev-$PGVERSION + - sudo apt-get -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::="--force-confnew" install postgresql-$PGVERSION postgresql-server-dev-$PGVERSION postgresql-$PGVERSION-pgtap - sudo chmod 777 /etc/postgresql/$PGVERSION/main/pg_hba.conf - sudo echo "local all postgres trust" > /etc/postgresql/$PGVERSION/main/pg_hba.conf - sudo echo "local all all trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf From 98a270de451a7ec468612ccb4a07103ea575ed3e Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Fri, 9 Nov 2018 23:00:07 +0100 Subject: [PATCH 12/19] Add standard tests for pg_tap --- .travis.yml | 1 + test/base.sql | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 test/base.sql diff --git a/.travis.yml b/.travis.yml index 8e0094e..9285b5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,6 +53,7 @@ script: - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-structure.sql -U postgres $DBFLOW - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-instance.sql -U postgres $DBFLOW - psql -v "ON_ERROR_STOP=1" -f ./sql/sqlflow-functions.sql -U postgres $DBFLOW + - pg_prove -U postgres -d $DBFLOW test/*.sql after_success: - echo "Success OK" diff --git a/test/base.sql b/test/base.sql new file mode 100644 index 0000000..d6f002d --- /dev/null +++ b/test/base.sql @@ -0,0 +1,10 @@ +-- Start transaction and plan the tests. +BEGIN; +SELECT plan(1); + +-- Run the tests. +SELECT pass( 'My test passed, w00t!' ); + +-- Finish the tests and clean up. +SELECT * FROM finish(); +ROLLBACK; From 8158df8fd576ea2eb1c94887efbdf6ab89a192d3 Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Fri, 9 Nov 2018 23:06:18 +0100 Subject: [PATCH 13/19] Remove old test file --- test/base.sql | 3 +++ test/sql/base.sql | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-) delete mode 100644 test/sql/base.sql diff --git a/test/base.sql b/test/base.sql index d6f002d..66384c5 100644 --- a/test/base.sql +++ b/test/base.sql @@ -5,6 +5,9 @@ SELECT plan(1); -- Run the tests. SELECT pass( 'My test passed, w00t!' ); +SELECT has_schema('sqlflow'); + + -- Finish the tests and clean up. SELECT * FROM finish(); ROLLBACK; diff --git a/test/sql/base.sql b/test/sql/base.sql deleted file mode 100644 index eec1cdc..0000000 --- a/test/sql/base.sql +++ /dev/null @@ -1,6 +0,0 @@ -\set ECHO none -BEGIN; - -SELECT 1; - -ROLLBACK; From 028b07e974467873f022ebf43a6abbfa55397b86 Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Fri, 9 Nov 2018 23:08:49 +0100 Subject: [PATCH 14/19] Add test type --- test/base.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/base.sql b/test/base.sql index 66384c5..06ee960 100644 --- a/test/base.sql +++ b/test/base.sql @@ -2,11 +2,13 @@ BEGIN; SELECT plan(1); --- Run the tests. -SELECT pass( 'My test passed, w00t!' ); +SELECT has_type('sqlflow', 'flow_type'); +SELECT has_type('sqlflow', 'flow_cond'); +SELECT has_type('sqlflow', 'flow_state'); SELECT has_schema('sqlflow'); +-- Table -- Finish the tests and clean up. SELECT * FROM finish(); From 9c8bd212e270b27d2884bdc10b5981ade5228fd5 Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Fri, 9 Nov 2018 23:16:41 +0100 Subject: [PATCH 15/19] Fix test --- test/base.sql | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/base.sql b/test/base.sql index 06ee960..4077e7f 100644 --- a/test/base.sql +++ b/test/base.sql @@ -1,12 +1,16 @@ -- Start transaction and plan the tests. BEGIN; -SELECT plan(1); +SELECT plan(6); + +-- Run test on sqlflow structure +SELECT has_schema('sqlflow'); SELECT has_type('sqlflow', 'flow_type'); SELECT has_type('sqlflow', 'flow_cond'); SELECT has_type('sqlflow', 'flow_state'); -SELECT has_schema('sqlflow'); +SELECT has_table('sqlflow', 'workflow'); +SELECT has_column('sqlflow', 'workflow', 'id', 'id columns exists') -- Table From a8226fd5deeb1d31341b91aa8af6226b0ee18211 Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Fri, 9 Nov 2018 23:24:54 +0100 Subject: [PATCH 16/19] another fix --- test/base.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/base.sql b/test/base.sql index 4077e7f..8882a12 100644 --- a/test/base.sql +++ b/test/base.sql @@ -12,8 +12,6 @@ SELECT has_type('sqlflow', 'flow_state'); SELECT has_table('sqlflow', 'workflow'); SELECT has_column('sqlflow', 'workflow', 'id', 'id columns exists') --- Table - -- Finish the tests and clean up. SELECT * FROM finish(); ROLLBACK; From 6076c7322c08a0f4648a8212d82a9046617d5e00 Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Fri, 9 Nov 2018 23:36:05 +0100 Subject: [PATCH 17/19] Add new tests --- test/base.sql | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/base.sql b/test/base.sql index 8882a12..fab6274 100644 --- a/test/base.sql +++ b/test/base.sql @@ -1,6 +1,6 @@ -- Start transaction and plan the tests. BEGIN; -SELECT plan(6); +SELECT plan(10); -- Run test on sqlflow structure SELECT has_schema('sqlflow'); @@ -10,7 +10,11 @@ SELECT has_type('sqlflow', 'flow_cond'); SELECT has_type('sqlflow', 'flow_state'); SELECT has_table('sqlflow', 'workflow'); -SELECT has_column('sqlflow', 'workflow', 'id', 'id columns exists') +SELECT has_column('sqlflow', 'workflow', 'id', 'id column exists'); +SELECT has_column('sqlflow', 'workflow', 'uref', 'uref column exists'); +SELECT has_column('sqlflow', 'workflow', 'title', 'title column exists'); +SELECT has_column('sqlflow', 'workflow', 'rel_table', 'rel_table column exists'); +SELECT has_column('sqlflow', 'workflow', 'flow_type', 'flow_type column exists'); -- Finish the tests and clean up. SELECT * FROM finish(); From 16a97dde7f9ef25d0cf1f9d847d3d3538f5c71fd Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Fri, 9 Nov 2018 23:41:33 +0100 Subject: [PATCH 18/19] Add description for test --- test/base.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/base.sql b/test/base.sql index fab6274..d2b7ed9 100644 --- a/test/base.sql +++ b/test/base.sql @@ -5,11 +5,11 @@ SELECT plan(10); -- Run test on sqlflow structure SELECT has_schema('sqlflow'); -SELECT has_type('sqlflow', 'flow_type'); -SELECT has_type('sqlflow', 'flow_cond'); -SELECT has_type('sqlflow', 'flow_state'); +SELECT has_type('sqlflow', 'flow_type', 'flow_type exists'); +SELECT has_type('sqlflow', 'flow_cond', 'flow_cond exists'); +SELECT has_type('sqlflow', 'flow_state', 'flow_state exists'); -SELECT has_table('sqlflow', 'workflow'); +SELECT has_table('sqlflow', 'workflow', 'workflow table exists'); SELECT has_column('sqlflow', 'workflow', 'id', 'id column exists'); SELECT has_column('sqlflow', 'workflow', 'uref', 'uref column exists'); SELECT has_column('sqlflow', 'workflow', 'title', 'title column exists'); From 8bf20ae2b1c17508ed559dbca85f3a233b9a118e Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Sat, 10 Nov 2018 07:37:01 +0100 Subject: [PATCH 19/19] Remove unnecessary field --- sql/sqlflow-instance.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/sqlflow-instance.sql b/sql/sqlflow-instance.sql index 245855c..ec22a3b 100644 --- a/sql/sqlflow-instance.sql +++ b/sql/sqlflow-instance.sql @@ -8,7 +8,6 @@ SET search_path TO sqlflow, public; CREATE TABLE sqlflow.instance ( id bigserial, - -- workflow_id integer REFERENCES sqlflow.workflow ON DELETE CASCADE, version_id integer REFERENCES sqlflow.version ON DELETE CASCADE ON UPDATE CASCADE, rel_table character varying(127) NOT NULL, flow_type flow_type NOT NULL DEFAULT 'row',