Skip to content

Commit 5974a68

Browse files
committed
package as an extension
1 parent c42e975 commit 5974a68

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

.travis.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1+
sudo: required
12
install:
23
- pip install psycopg2
3-
- git submodule init
4-
- git submodule update
5-
before_script:
6-
psql -c 'CREATE DATABASE json_test;' -U postgres
4+
- psql -c 'CREATE DATABASE json_test;' -U postgres
5+
- sudo make install
6+
- psql json_test -c 'CREATE EXTENSION "postgres-json-schema";' -U postgres
77
env:
88
- DATABASE_URL=postgres:///json_test
99
services:
1010
- postgresql
1111
addons:
1212
postgresql: "9.4"
13+
apt:
14+
packages:
15+
- postgresql-server-dev-9.4
1316
script: python test.py
1417
language: python

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
EXTENSION = postgres-json-schema
2+
DATA = postgres-json-schema--0.1.0.sql
3+
4+
# postgres build stuff
5+
PG_CONFIG = pg_config
6+
PGXS := $(shell $(PG_CONFIG) --pgxs)
7+
include $(PGXS)

jsonschema.sql renamed to postgres-json-schema--0.1.0.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ BEGIN
1414
END IF;
1515
RETURN true;
1616
END;
17-
$f$ LANGUAGE 'plpgsql';
17+
$f$ LANGUAGE 'plpgsql' IMMUTABLE;
1818

1919

2020
CREATE OR REPLACE FUNCTION validate_json_schema(schema jsonb, data jsonb, root_schema jsonb DEFAULT NULL) RETURNS boolean AS $f$
@@ -256,4 +256,4 @@ BEGIN
256256

257257
RETURN true;
258258
END;
259-
$f$ LANGUAGE 'plpgsql';
259+
$f$ LANGUAGE 'plpgsql' IMMUTABLE;

postgres-json-schema.control

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
comment = 'Validate JSON schemas'
2+
relocatable = true
3+
default_version = '0.1.0'

test.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010

1111
cur = conn.cursor()
1212

13-
with open('jsonschema.sql') as f:
14-
cur.execute(f.read())
15-
16-
#with open('tests.sql') as f:
17-
#cur.execute(f.read())
18-
1913
EXCLUDE = {'optional', 'refRemote.json', 'definitions.json'}
2014

2115
os.chdir('JSON-Schema-Test-Suite/tests/draft4')

0 commit comments

Comments
 (0)