Skip to content

Commit

Permalink
Correct search path for deploy/revert
Browse files Browse the repository at this point in the history
Add tables confirmation on right schema in tests
  • Loading branch information
marcoarthur committed Aug 9, 2019
1 parent ead8f16 commit 1b53061
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deploy/pgtap.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

BEGIN;

CREATE EXTENSION IF NOT EXISTS pgtap;
CREATE EXTENSION IF NOT EXISTS pgtap;

COMMIT;
2 changes: 2 additions & 0 deletions deploy/schema_defs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
BEGIN;

-- Create a table which will contain a single row defining the current schema version.
SET search_path TO osm_brasil,public,topology;

CREATE TABLE schema_info (
version integer NOT NULL
);
Expand Down
1 change: 1 addition & 0 deletions revert/schema_defs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
BEGIN;

-- Drop all tables if they exist.
SET search_path TO osm_brasil,public,topology;
DROP TABLE IF EXISTS actions;
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS nodes;
Expand Down
24 changes: 22 additions & 2 deletions t/basic.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,28 @@ BEGIN;

SELECT no_plan();

-- SELECT ok('add tests here');
SELECT pass( 'My test passed, w00t!' );
SELECT has_schema( 'osm_brasil', 'schema presence' );

-- Check for all tables in application
SELECT has_table('osm_brasil', n, 'should have table osm_brasil.' || n )
FROM (
WITH tnames(n) AS (
VALUES
('schema_info'),
('users'),
('nodes'),
('node_tags'),
('ways'),
('way_nodes'),
('way_tags'),
('relations'),
('relation_members'),
('relation_tags')
)
SELECT n FROM tnames
) AS t;

SELECT finish();
ROLLBACK;

-- dbext:type=PGSQL:user=gis:host=127.0.0.1:dbname=lbo
1 change: 1 addition & 0 deletions verify/schema_defs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

BEGIN;

SET search_path TO osm_brasil,public,topology;
select * from schema_info;
select * from users;
select * from nodes;
Expand Down

0 comments on commit 1b53061

Please sign in to comment.