Update project name in strings

Fixes #105
This commit is contained in:
Joe Nelson
2014-12-17 10:24:24 -08:00
parent 5f4212e2fd
commit dbe1f59066
15 changed files with 167 additions and 166 deletions
+5 -4
View File
@@ -21,18 +21,19 @@ This will connect to a postgres DB at the url
You will need to provide two database roles (which are allowed to
be the same). One is called the authenticator role (`auth-role`
above) which should have enough privileges to read the `auth` table
in the `dbapi` schema if you intend to support multi-user applications.
in the `postgrest` schema if you intend to support multi-user
applications.
The other role is for anonymous access (`anonymous-role` above).
Immediately upon acceping any unauthenticated HTTP connection dbapi
Immediately upon acceping any unauthenticated HTTP connection postgrest
assumes this role in its queries to postgres. Give this role as
much or little permissions as you would like.
### Running tests
```sh
createuser --superuser --no-password dbapi_test
createdb -O dbapi_test -U postgres dbapi_test
createuser --superuser --no-password postgrest_test
createdb -O postgrest_test -U postgres postgrest_test
cabal test --show-details=always --test-options="--color"
```
+2 -2
View File
@@ -1,6 +1,6 @@
machine:
pre:
- createuser --superuser --no-password dbapi_test
- createdb -O dbapi_test -U ubuntu dbapi_test
- createuser --superuser --no-password postgrest_test
- createdb -O postgrest_test -U ubuntu postgrest_test
ghc:
version: 7.8.3
+4 -4
View File
@@ -1,10 +1,10 @@
export DBAPI_VER=`grep ^version /app/dbapi.cabal | sed -En 's/.*\s+([0-9\.]+)/\1/p'`
export POSTGREST_VER=`grep ^version /app/postgrest.cabal | sed -En 's/.*\s+([0-9\.]+)/\1/p'`
curl -L http://softlayer-ams.dl.sourceforge.net/project/s3tools/s3cmd/1.5.0-alpha1/s3cmd-1.5.0-alpha1.tar.gz | tar zx
cp /app/dist/build/dbapi/dbapi dbapi-${DBAPI_VER}
tar cJf dbapi-${DBAPI_VER}.tar.xz dbapi-${DBAPI_VER}
cp /app/dist/build/postgrest/postgrest postgrest-${POSTGREST_VER}
tar cJf postgrest-${POSTGREST_VER}.tar.xz postgrest-${POSTGREST_VER}
touch ~/.s3cfg
s3cmd-1.5.0-alpha1/s3cmd put --access_key=${S3_ACCESS_KEY} --secret_key=${S3_SECRET_KEY} -P -f dbapi-${DBAPI_VER}.tar.xz $S3_BUCKET/dbapi-${DBAPI_VER}.tar.xz
s3cmd-1.5.0-alpha1/s3cmd put --access_key=${S3_ACCESS_KEY} --secret_key=${S3_SECRET_KEY} -P -f postgrest-${POSTGREST_VER}.tar.xz $S3_BUCKET/postgrest-${POSTGREST_VER}.tar.xz
+2 -2
View File
@@ -83,7 +83,7 @@ app reqBody req =
)
] (cs $ fromMaybe "[]" body)
(["dbapi", "users"], "POST") -> do
(["postgrest", "users"], "POST") -> do
let user = decode reqBody :: Maybe AuthUser
case user of
@@ -94,7 +94,7 @@ app reqBody req =
(cs $ userPass u) (cs $ userRole u)
return $ responseLBS status201
[ jsonH
, (hLocation, "/dbapi/users?id=eq." <> cs (userId u))
, (hLocation, "/postgrest/users?id=eq." <> cs (userId u))
] ""
([table], "POST") ->
+2 -2
View File
@@ -55,12 +55,12 @@ addUser :: Text -> Text -> Text -> H.Tx H.Postgres s ()
addUser identity pass role = do
let Just hashed = unsafePerformIO $ hashPasswordUsingPolicy fastBcryptHashingPolicy (cs pass)
H.unit $
[H.q|insert into dbapi.auth (id, pass, rolname) values (?, ?, ?)|]
[H.q|insert into postgrest.auth (id, pass, rolname) values (?, ?, ?)|]
identity (cs hashed :: Text) role
signInRole :: Text -> Text -> H.Tx H.Postgres s LoginAttempt
signInRole user pass = do
u <- H.single $ [H.q|select pass, rolname from dbapi.auth where id = ?|] user
u <- H.single $ [H.q|select pass, rolname from postgrest.auth where id = ?|] user
return $ maybe LoginFailed (\r ->
let (hashed, role) = r in
if checkPass hashed pass
+1 -1
View File
@@ -42,7 +42,7 @@ main = do
H.sessionSettings (fromIntegral $ configPool conf) 30
let appSettings = setPort port
. setServerName (cs $ "dbapi/" <> prettyVersion)
. setServerName (cs $ "postgrest/" <> prettyVersion)
$ defaultSettings
middle =
(if configSecure conf then redirectInsecure else id)
+2 -2
View File
@@ -16,11 +16,11 @@ spec = before resetDb $ around withApp $
it "hides tables that anonymous does not own" $
get "/authors_only" `shouldRespondWith` 400 -- TODO: should be 404
it "indicates login failure" $ do
let auth = authHeader "dbapi_test_author" "fakefake"
let auth = authHeader "postgrest_test_author" "fakefake"
request methodGet "/authors_only" [auth] ""
`shouldRespondWith` 401
it "allows users with permissions to see their tables" $ do
_ <- post "/dbapi/users" [json| { "id":"jdoe", "pass": "1234", "role": "dbapi_test_author" } |]
_ <- post "/postgrest/users" [json| { "id":"jdoe", "pass": "1234", "role": "postgrest_test_author" } |]
let auth = authHeader "jdoe" "1234"
request methodGet "/authors_only" [auth] ""
`shouldRespondWith` 200
+1 -1
View File
@@ -26,7 +26,7 @@ spec = before resetDb $ around withApp $ do
{matchStatus = 200}
it "lists only views user has permission to see" $ do
_ <- post "/dbapi/users" [json| { "id":"jdoe", "pass": "1234", "role": "dbapi_test_author" } |]
_ <- post "/postgrest/users" [json| { "id":"jdoe", "pass": "1234", "role": "postgrest_test_author" } |]
let auth = authHeader "jdoe" "1234"
request methodGet "/" [auth] ""
+4 -4
View File
@@ -34,13 +34,13 @@ isLeft (Left _ ) = True
isLeft _ = False
cfg :: AppConfig
cfg = AppConfig "dbapi_test" 5432 "dbapi_test" "" "localhost" 3000 "dbapi_anonymous" False 10
cfg = AppConfig "postgrest_test" 5432 "postgrest_test" "" "localhost" 3000 "postgrest_anonymous" False 10
testSettings :: SessionSettings
testSettings = fromMaybe (error "bad settings") $ H.sessionSettings 1 30
pgSettings :: Postgres
pgSettings = H.ParamSettings "localhost" 5432 "dbapi_test" "" "dbapi_test"
pgSettings = H.ParamSettings "localhost" 5432 "postgrest_test" "" "postgrest_test"
withApp :: ActionWith Application -> IO ()
withApp perform =
@@ -63,7 +63,7 @@ resetDb = do
H.tx Nothing $ do
H.unit [H.q| drop schema if exists "1" cascade |]
H.unit [H.q| drop schema if exists private cascade |]
H.unit [H.q| drop schema if exists dbapi cascade |]
H.unit [H.q| drop schema if exists postgrest cascade |]
loadFixture "roles"
loadFixture "schema"
@@ -71,7 +71,7 @@ resetDb = do
loadFixture :: FilePath -> IO()
loadFixture name =
void $ readProcess "psql" ["-U", "dbapi_test", "-d", "dbapi_test", "-a", "-f", "test/fixtures/" ++ name ++ ".sql"] []
void $ readProcess "psql" ["-U", "postgrest_test", "-d", "postgrest_test", "-a", "-f", "test/fixtures/" ++ name ++ ".sql"] []
rangeHdrs :: ByteRange -> [Header]
+1 -1
View File
@@ -25,7 +25,7 @@ spec = let
it "allows partial rollback of request" $ \c -> do
let app = withSavepoint Test dbErrApp c
[[beforeCount]] <- quickQuery c "select count(*) from \"1\".items" []
runRaw c "set role dbapi_anonymous"
runRaw c "set role postgrest_anonymous"
_ <- insert "1" "items" (SqlRow []) c
catch (void $ app defaultRequest (const undefined) ) $
\e -> let _ = (e::SqlError) in do
+1 -1
View File
@@ -64,7 +64,7 @@ spec = around dbWithSchema $ do
describe "addUser" $ do
it "adds a correct user to the right table" $ \conn -> do
addUser user pass role conn
[r] <- quickQuery conn "select * from dbapi.auth" []
[r] <- quickQuery conn "select * from postgrest.auth" []
let [newUser, newRole, encryptedPass] = map fromSql r :: [String]
cs newUser `shouldBe` user
cs newRole `shouldBe` role
+1 -1
View File
@@ -34,4 +34,4 @@ spec = around dbWithSchema $ beforeWith setRole $ do
("auto_inc_fk", ForeignKey {fkTable="auto_incrementing_pk", fkCol="id"}),
("simple_fk", ForeignKey { fkTable="simple_pk", fkCol="k"})]
where setRole conn = quickQuery conn "set role dbapi_test" [] >> return conn
where setRole conn = quickQuery conn "set role postgrest_test" [] >> return conn
+1 -1
View File
@@ -1 +1 @@
pg_dump --host localhost --port 5432 --username "postgres" --no-password --format plain --column-inserts --verbose --file "./test/fixtures/schema.sql" "dbapi_test"
pg_dump --host localhost --port 5432 --username "postgres" --no-password --format plain --column-inserts --verbose --file "./test/fixtures/schema.sql" "postgrest_test"
+2 -2
View File
@@ -11,6 +11,6 @@ BEGIN
END;
$$;
select pg_temp.create_role_if_not_exists('dbapi_anonymous', 'with nologin') as a
select pg_temp.create_role_if_not_exists('postgrest_anonymous', 'with nologin') as a
, pg_temp.create_role_if_not_exists('test_default_role', 'with nologin') as b
, pg_temp.create_role_if_not_exists('dbapi_test_author', 'with nologin') into temp shh;
, pg_temp.create_role_if_not_exists('postgrest_test_author', 'with nologin') into temp shh;
+138 -138
View File
@@ -14,33 +14,33 @@ SET client_min_messages = warning;
--
-- TOC entry 20 (class 2615 OID 337536)
-- Name: 1; Type: SCHEMA; Schema: -; Owner: dbapi_test
-- Name: 1; Type: SCHEMA; Schema: -; Owner: postgrest_test
--
CREATE SCHEMA "1";
ALTER SCHEMA "1" OWNER TO dbapi_test;
ALTER SCHEMA "1" OWNER TO postgrest_test;
--
-- TOC entry 19 (class 2615 OID 337537)
-- Name: dbapi; Type: SCHEMA; Schema: -; Owner: dbapi_test
-- Name: postgrest; Type: SCHEMA; Schema: -; Owner: postgrest_test
--
CREATE SCHEMA dbapi;
CREATE SCHEMA postgrest;
ALTER SCHEMA dbapi OWNER TO dbapi_test;
ALTER SCHEMA postgrest OWNER TO postgrest_test;
--
-- TOC entry 16 (class 2615 OID 337538)
-- Name: private; Type: SCHEMA; Schema: -; Owner: dbapi_test
-- Name: private; Type: SCHEMA; Schema: -; Owner: postgrest_test
--
CREATE SCHEMA private;
ALTER SCHEMA private OWNER TO dbapi_test;
ALTER SCHEMA private OWNER TO postgrest_test;
--
-- TOC entry 205 (class 3079 OID 12018)
@@ -63,7 +63,7 @@ SET search_path = "1", pg_catalog;
--
-- TOC entry 553 (class 1247 OID 337540)
-- Name: enum_menagerie_type; Type: TYPE; Schema: 1; Owner: dbapi_test
-- Name: enum_menagerie_type; Type: TYPE; Schema: 1; Owner: postgrest_test
--
CREATE TYPE enum_menagerie_type AS ENUM (
@@ -72,13 +72,13 @@ CREATE TYPE enum_menagerie_type AS ENUM (
);
ALTER TYPE "1".enum_menagerie_type OWNER TO dbapi_test;
ALTER TYPE "1".enum_menagerie_type OWNER TO postgrest_test;
SET search_path = dbapi, pg_catalog;
SET search_path = postgrest, pg_catalog;
--
-- TOC entry 218 (class 1255 OID 337545)
-- Name: check_role_exists(); Type: FUNCTION; Schema: dbapi; Owner: dbapi_test
-- Name: check_role_exists(); Type: FUNCTION; Schema: postgrest; Owner: postgrest_test
--
CREATE FUNCTION check_role_exists() RETURNS trigger
@@ -94,11 +94,11 @@ end
$$;
ALTER FUNCTION dbapi.check_role_exists() OWNER TO dbapi_test;
ALTER FUNCTION postgrest.check_role_exists() OWNER TO postgrest_test;
--
-- TOC entry 219 (class 1255 OID 337546)
-- Name: update_owner(); Type: FUNCTION; Schema: dbapi; Owner: dbapi_test
-- Name: update_owner(); Type: FUNCTION; Schema: postgrest; Owner: postgrest_test
--
CREATE FUNCTION update_owner() RETURNS trigger
@@ -111,7 +111,7 @@ END;
$$;
ALTER FUNCTION dbapi.update_owner() OWNER TO dbapi_test;
ALTER FUNCTION postgrest.update_owner() OWNER TO postgrest_test;
SET search_path = "1", pg_catalog;
@@ -121,7 +121,7 @@ SET default_with_oids = false;
--
-- TOC entry 191 (class 1259 OID 337547)
-- Name: authors_only; Type: TABLE; Schema: 1; Owner: dbapi_test_author; Tablespace:
-- Name: authors_only; Type: TABLE; Schema: 1; Owner: postgrest_test_author; Tablespace:
--
CREATE TABLE authors_only (
@@ -129,11 +129,11 @@ CREATE TABLE authors_only (
);
ALTER TABLE "1".authors_only OWNER TO dbapi_test_author;
ALTER TABLE "1".authors_only OWNER TO postgrest_test_author;
--
-- TOC entry 192 (class 1259 OID 337553)
-- Name: auto_incrementing_pk; Type: TABLE; Schema: 1; Owner: dbapi_test; Tablespace:
-- Name: auto_incrementing_pk; Type: TABLE; Schema: 1; Owner: postgrest_test; Tablespace:
--
CREATE TABLE auto_incrementing_pk (
@@ -144,11 +144,11 @@ CREATE TABLE auto_incrementing_pk (
);
ALTER TABLE "1".auto_incrementing_pk OWNER TO dbapi_test;
ALTER TABLE "1".auto_incrementing_pk OWNER TO postgrest_test;
--
-- TOC entry 193 (class 1259 OID 337560)
-- Name: auto_incrementing_pk_id_seq; Type: SEQUENCE; Schema: 1; Owner: dbapi_test
-- Name: auto_incrementing_pk_id_seq; Type: SEQUENCE; Schema: 1; Owner: postgrest_test
--
CREATE SEQUENCE auto_incrementing_pk_id_seq
@@ -159,12 +159,12 @@ CREATE SEQUENCE auto_incrementing_pk_id_seq
CACHE 1;
ALTER TABLE "1".auto_incrementing_pk_id_seq OWNER TO dbapi_test;
ALTER TABLE "1".auto_incrementing_pk_id_seq OWNER TO postgrest_test;
--
-- TOC entry 2324 (class 0 OID 0)
-- Dependencies: 193
-- Name: auto_incrementing_pk_id_seq; Type: SEQUENCE OWNED BY; Schema: 1; Owner: dbapi_test
-- Name: auto_incrementing_pk_id_seq; Type: SEQUENCE OWNED BY; Schema: 1; Owner: postgrest_test
--
ALTER SEQUENCE auto_incrementing_pk_id_seq OWNED BY auto_incrementing_pk.id;
@@ -172,7 +172,7 @@ ALTER SEQUENCE auto_incrementing_pk_id_seq OWNED BY auto_incrementing_pk.id;
--
-- TOC entry 194 (class 1259 OID 337562)
-- Name: compound_pk; Type: TABLE; Schema: 1; Owner: dbapi_test; Tablespace:
-- Name: compound_pk; Type: TABLE; Schema: 1; Owner: postgrest_test; Tablespace:
--
CREATE TABLE compound_pk (
@@ -182,11 +182,11 @@ CREATE TABLE compound_pk (
);
ALTER TABLE "1".compound_pk OWNER TO dbapi_test;
ALTER TABLE "1".compound_pk OWNER TO postgrest_test;
--
-- TOC entry 195 (class 1259 OID 337565)
-- Name: has_fk; Type: TABLE; Schema: 1; Owner: dbapi_test; Tablespace:
-- Name: has_fk; Type: TABLE; Schema: 1; Owner: postgrest_test; Tablespace:
--
CREATE TABLE has_fk (
@@ -196,11 +196,11 @@ CREATE TABLE has_fk (
);
ALTER TABLE "1".has_fk OWNER TO dbapi_test;
ALTER TABLE "1".has_fk OWNER TO postgrest_test;
--
-- TOC entry 196 (class 1259 OID 337568)
-- Name: has_fk_id_seq; Type: SEQUENCE; Schema: 1; Owner: dbapi_test
-- Name: has_fk_id_seq; Type: SEQUENCE; Schema: 1; Owner: postgrest_test
--
CREATE SEQUENCE has_fk_id_seq
@@ -211,12 +211,12 @@ CREATE SEQUENCE has_fk_id_seq
CACHE 1;
ALTER TABLE "1".has_fk_id_seq OWNER TO dbapi_test;
ALTER TABLE "1".has_fk_id_seq OWNER TO postgrest_test;
--
-- TOC entry 2327 (class 0 OID 0)
-- Dependencies: 196
-- Name: has_fk_id_seq; Type: SEQUENCE OWNED BY; Schema: 1; Owner: dbapi_test
-- Name: has_fk_id_seq; Type: SEQUENCE OWNED BY; Schema: 1; Owner: postgrest_test
--
ALTER SEQUENCE has_fk_id_seq OWNED BY has_fk.id;
@@ -224,7 +224,7 @@ ALTER SEQUENCE has_fk_id_seq OWNED BY has_fk.id;
--
-- TOC entry 197 (class 1259 OID 337570)
-- Name: items; Type: TABLE; Schema: 1; Owner: dbapi_test; Tablespace:
-- Name: items; Type: TABLE; Schema: 1; Owner: postgrest_test; Tablespace:
--
CREATE TABLE items (
@@ -232,11 +232,11 @@ CREATE TABLE items (
);
ALTER TABLE "1".items OWNER TO dbapi_test;
ALTER TABLE "1".items OWNER TO postgrest_test;
--
-- TOC entry 198 (class 1259 OID 337573)
-- Name: items_id_seq; Type: SEQUENCE; Schema: 1; Owner: dbapi_test
-- Name: items_id_seq; Type: SEQUENCE; Schema: 1; Owner: postgrest_test
--
CREATE SEQUENCE items_id_seq
@@ -247,12 +247,12 @@ CREATE SEQUENCE items_id_seq
CACHE 1;
ALTER TABLE "1".items_id_seq OWNER TO dbapi_test;
ALTER TABLE "1".items_id_seq OWNER TO postgrest_test;
--
-- TOC entry 2329 (class 0 OID 0)
-- Dependencies: 198
-- Name: items_id_seq; Type: SEQUENCE OWNED BY; Schema: 1; Owner: dbapi_test
-- Name: items_id_seq; Type: SEQUENCE OWNED BY; Schema: 1; Owner: postgrest_test
--
ALTER SEQUENCE items_id_seq OWNED BY items.id;
@@ -260,7 +260,7 @@ ALTER SEQUENCE items_id_seq OWNED BY items.id;
--
-- TOC entry 199 (class 1259 OID 337575)
-- Name: menagerie; Type: TABLE; Schema: 1; Owner: dbapi_test; Tablespace:
-- Name: menagerie; Type: TABLE; Schema: 1; Owner: postgrest_test; Tablespace:
--
CREATE TABLE menagerie (
@@ -274,11 +274,11 @@ CREATE TABLE menagerie (
);
ALTER TABLE "1".menagerie OWNER TO dbapi_test;
ALTER TABLE "1".menagerie OWNER TO postgrest_test;
--
-- TOC entry 200 (class 1259 OID 337581)
-- Name: no_pk; Type: TABLE; Schema: 1; Owner: dbapi_test; Tablespace:
-- Name: no_pk; Type: TABLE; Schema: 1; Owner: postgrest_test; Tablespace:
--
CREATE TABLE no_pk (
@@ -287,11 +287,11 @@ CREATE TABLE no_pk (
);
ALTER TABLE "1".no_pk OWNER TO dbapi_test;
ALTER TABLE "1".no_pk OWNER TO postgrest_test;
--
-- TOC entry 201 (class 1259 OID 337587)
-- Name: simple_pk; Type: TABLE; Schema: 1; Owner: dbapi_test; Tablespace:
-- Name: simple_pk; Type: TABLE; Schema: 1; Owner: postgrest_test; Tablespace:
--
CREATE TABLE simple_pk (
@@ -300,13 +300,13 @@ CREATE TABLE simple_pk (
);
ALTER TABLE "1".simple_pk OWNER TO dbapi_test;
ALTER TABLE "1".simple_pk OWNER TO postgrest_test;
SET search_path = dbapi, pg_catalog;
SET search_path = postgrest, pg_catalog;
--
-- TOC entry 202 (class 1259 OID 337593)
-- Name: auth; Type: TABLE; Schema: dbapi; Owner: dbapi_test; Tablespace:
-- Name: auth; Type: TABLE; Schema: postgrest; Owner: postgrest_test; Tablespace:
--
CREATE TABLE auth (
@@ -316,13 +316,13 @@ CREATE TABLE auth (
);
ALTER TABLE dbapi.auth OWNER TO dbapi_test;
ALTER TABLE postgrest.auth OWNER TO postgrest_test;
SET search_path = private, pg_catalog;
--
-- TOC entry 203 (class 1259 OID 337599)
-- Name: articles; Type: TABLE; Schema: private; Owner: dbapi_test; Tablespace:
-- Name: articles; Type: TABLE; Schema: private; Owner: postgrest_test; Tablespace:
--
CREATE TABLE articles (
@@ -332,11 +332,11 @@ CREATE TABLE articles (
);
ALTER TABLE private.articles OWNER TO dbapi_test;
ALTER TABLE private.articles OWNER TO postgrest_test;
--
-- TOC entry 204 (class 1259 OID 337605)
-- Name: articles_id_seq; Type: SEQUENCE; Schema: private; Owner: dbapi_test
-- Name: articles_id_seq; Type: SEQUENCE; Schema: private; Owner: postgrest_test
--
CREATE SEQUENCE articles_id_seq
@@ -347,12 +347,12 @@ CREATE SEQUENCE articles_id_seq
CACHE 1;
ALTER TABLE private.articles_id_seq OWNER TO dbapi_test;
ALTER TABLE private.articles_id_seq OWNER TO postgrest_test;
--
-- TOC entry 2336 (class 0 OID 0)
-- Dependencies: 204
-- Name: articles_id_seq; Type: SEQUENCE OWNED BY; Schema: private; Owner: dbapi_test
-- Name: articles_id_seq; Type: SEQUENCE OWNED BY; Schema: private; Owner: postgrest_test
--
ALTER SEQUENCE articles_id_seq OWNED BY articles.id;
@@ -362,7 +362,7 @@ SET search_path = "1", pg_catalog;
--
-- TOC entry 2165 (class 2604 OID 337607)
-- Name: id; Type: DEFAULT; Schema: 1; Owner: dbapi_test
-- Name: id; Type: DEFAULT; Schema: 1; Owner: postgrest_test
--
ALTER TABLE ONLY auto_incrementing_pk ALTER COLUMN id SET DEFAULT nextval('auto_incrementing_pk_id_seq'::regclass);
@@ -370,7 +370,7 @@ ALTER TABLE ONLY auto_incrementing_pk ALTER COLUMN id SET DEFAULT nextval('auto_
--
-- TOC entry 2166 (class 2604 OID 337608)
-- Name: id; Type: DEFAULT; Schema: 1; Owner: dbapi_test
-- Name: id; Type: DEFAULT; Schema: 1; Owner: postgrest_test
--
ALTER TABLE ONLY has_fk ALTER COLUMN id SET DEFAULT nextval('has_fk_id_seq'::regclass);
@@ -378,7 +378,7 @@ ALTER TABLE ONLY has_fk ALTER COLUMN id SET DEFAULT nextval('has_fk_id_seq'::reg
--
-- TOC entry 2167 (class 2604 OID 337609)
-- Name: id; Type: DEFAULT; Schema: 1; Owner: dbapi_test
-- Name: id; Type: DEFAULT; Schema: 1; Owner: postgrest_test
--
ALTER TABLE ONLY items ALTER COLUMN id SET DEFAULT nextval('items_id_seq'::regclass);
@@ -388,7 +388,7 @@ SET search_path = private, pg_catalog;
--
-- TOC entry 2168 (class 2604 OID 337610)
-- Name: id; Type: DEFAULT; Schema: private; Owner: dbapi_test
-- Name: id; Type: DEFAULT; Schema: private; Owner: postgrest_test
--
ALTER TABLE ONLY articles ALTER COLUMN id SET DEFAULT nextval('articles_id_seq'::regclass);
@@ -399,7 +399,7 @@ SET search_path = "1", pg_catalog;
--
-- TOC entry 2298 (class 0 OID 337547)
-- Dependencies: 191
-- Data for Name: authors_only; Type: TABLE DATA; Schema: 1; Owner: dbapi_test_author
-- Data for Name: authors_only; Type: TABLE DATA; Schema: 1; Owner: postgrest_test_author
--
@@ -407,7 +407,7 @@ SET search_path = "1", pg_catalog;
--
-- TOC entry 2299 (class 0 OID 337553)
-- Dependencies: 192
-- Data for Name: auto_incrementing_pk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
-- Data for Name: auto_incrementing_pk; Type: TABLE DATA; Schema: 1; Owner: postgrest_test
--
@@ -415,7 +415,7 @@ SET search_path = "1", pg_catalog;
--
-- TOC entry 2337 (class 0 OID 0)
-- Dependencies: 193
-- Name: auto_incrementing_pk_id_seq; Type: SEQUENCE SET; Schema: 1; Owner: dbapi_test
-- Name: auto_incrementing_pk_id_seq; Type: SEQUENCE SET; Schema: 1; Owner: postgrest_test
--
SELECT pg_catalog.setval('auto_incrementing_pk_id_seq', 54, true);
@@ -424,7 +424,7 @@ SELECT pg_catalog.setval('auto_incrementing_pk_id_seq', 54, true);
--
-- TOC entry 2301 (class 0 OID 337562)
-- Dependencies: 194
-- Data for Name: compound_pk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
-- Data for Name: compound_pk; Type: TABLE DATA; Schema: 1; Owner: postgrest_test
--
@@ -432,7 +432,7 @@ SELECT pg_catalog.setval('auto_incrementing_pk_id_seq', 54, true);
--
-- TOC entry 2302 (class 0 OID 337565)
-- Dependencies: 195
-- Data for Name: has_fk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
-- Data for Name: has_fk; Type: TABLE DATA; Schema: 1; Owner: postgrest_test
--
@@ -440,7 +440,7 @@ SELECT pg_catalog.setval('auto_incrementing_pk_id_seq', 54, true);
--
-- TOC entry 2338 (class 0 OID 0)
-- Dependencies: 196
-- Name: has_fk_id_seq; Type: SEQUENCE SET; Schema: 1; Owner: dbapi_test
-- Name: has_fk_id_seq; Type: SEQUENCE SET; Schema: 1; Owner: postgrest_test
--
SELECT pg_catalog.setval('has_fk_id_seq', 1, false);
@@ -449,7 +449,7 @@ SELECT pg_catalog.setval('has_fk_id_seq', 1, false);
--
-- TOC entry 2304 (class 0 OID 337570)
-- Dependencies: 197
-- Data for Name: items; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
-- Data for Name: items; Type: TABLE DATA; Schema: 1; Owner: postgrest_test
--
INSERT INTO items (id) VALUES (1);
@@ -472,7 +472,7 @@ INSERT INTO items (id) VALUES (15);
--
-- TOC entry 2339 (class 0 OID 0)
-- Dependencies: 198
-- Name: items_id_seq; Type: SEQUENCE SET; Schema: 1; Owner: dbapi_test
-- Name: items_id_seq; Type: SEQUENCE SET; Schema: 1; Owner: postgrest_test
--
SELECT pg_catalog.setval('items_id_seq', 19, true);
@@ -481,7 +481,7 @@ SELECT pg_catalog.setval('items_id_seq', 19, true);
--
-- TOC entry 2306 (class 0 OID 337575)
-- Dependencies: 199
-- Data for Name: menagerie; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
-- Data for Name: menagerie; Type: TABLE DATA; Schema: 1; Owner: postgrest_test
--
@@ -489,7 +489,7 @@ SELECT pg_catalog.setval('items_id_seq', 19, true);
--
-- TOC entry 2307 (class 0 OID 337581)
-- Dependencies: 200
-- Data for Name: no_pk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
-- Data for Name: no_pk; Type: TABLE DATA; Schema: 1; Owner: postgrest_test
--
@@ -497,17 +497,17 @@ SELECT pg_catalog.setval('items_id_seq', 19, true);
--
-- TOC entry 2308 (class 0 OID 337587)
-- Dependencies: 201
-- Data for Name: simple_pk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
-- Data for Name: simple_pk; Type: TABLE DATA; Schema: 1; Owner: postgrest_test
--
SET search_path = dbapi, pg_catalog;
SET search_path = postgrest, pg_catalog;
--
-- TOC entry 2309 (class 0 OID 337593)
-- Dependencies: 202
-- Data for Name: auth; Type: TABLE DATA; Schema: dbapi; Owner: dbapi_test
-- Data for Name: auth; Type: TABLE DATA; Schema: postgrest; Owner: postgrest_test
--
@@ -517,7 +517,7 @@ SET search_path = private, pg_catalog;
--
-- TOC entry 2310 (class 0 OID 337599)
-- Dependencies: 203
-- Data for Name: articles; Type: TABLE DATA; Schema: private; Owner: dbapi_test
-- Data for Name: articles; Type: TABLE DATA; Schema: private; Owner: postgrest_test
--
@@ -525,7 +525,7 @@ SET search_path = private, pg_catalog;
--
-- TOC entry 2340 (class 0 OID 0)
-- Dependencies: 204
-- Name: articles_id_seq; Type: SEQUENCE SET; Schema: private; Owner: dbapi_test
-- Name: articles_id_seq; Type: SEQUENCE SET; Schema: private; Owner: postgrest_test
--
SELECT pg_catalog.setval('articles_id_seq', 1, false);
@@ -535,7 +535,7 @@ SET search_path = "1", pg_catalog;
--
-- TOC entry 2170 (class 2606 OID 337612)
-- Name: authors_only_pkey; Type: CONSTRAINT; Schema: 1; Owner: dbapi_test_author; Tablespace:
-- Name: authors_only_pkey; Type: CONSTRAINT; Schema: 1; Owner: postgrest_test_author; Tablespace:
--
ALTER TABLE ONLY authors_only
@@ -544,7 +544,7 @@ ALTER TABLE ONLY authors_only
--
-- TOC entry 2172 (class 2606 OID 337614)
-- Name: auto_incrementing_pk_pkey; Type: CONSTRAINT; Schema: 1; Owner: dbapi_test; Tablespace:
-- Name: auto_incrementing_pk_pkey; Type: CONSTRAINT; Schema: 1; Owner: postgrest_test; Tablespace:
--
ALTER TABLE ONLY auto_incrementing_pk
@@ -553,7 +553,7 @@ ALTER TABLE ONLY auto_incrementing_pk
--
-- TOC entry 2174 (class 2606 OID 337616)
-- Name: compound_pk_pkey; Type: CONSTRAINT; Schema: 1; Owner: dbapi_test; Tablespace:
-- Name: compound_pk_pkey; Type: CONSTRAINT; Schema: 1; Owner: postgrest_test; Tablespace:
--
ALTER TABLE ONLY compound_pk
@@ -562,7 +562,7 @@ ALTER TABLE ONLY compound_pk
--
-- TOC entry 2182 (class 2606 OID 337618)
-- Name: contacts_pkey; Type: CONSTRAINT; Schema: 1; Owner: dbapi_test; Tablespace:
-- Name: contacts_pkey; Type: CONSTRAINT; Schema: 1; Owner: postgrest_test; Tablespace:
--
ALTER TABLE ONLY simple_pk
@@ -571,7 +571,7 @@ ALTER TABLE ONLY simple_pk
--
-- TOC entry 2176 (class 2606 OID 337620)
-- Name: has_fk_pkey; Type: CONSTRAINT; Schema: 1; Owner: dbapi_test; Tablespace:
-- Name: has_fk_pkey; Type: CONSTRAINT; Schema: 1; Owner: postgrest_test; Tablespace:
--
ALTER TABLE ONLY has_fk
@@ -580,7 +580,7 @@ ALTER TABLE ONLY has_fk
--
-- TOC entry 2178 (class 2606 OID 337622)
-- Name: items_pkey; Type: CONSTRAINT; Schema: 1; Owner: dbapi_test; Tablespace:
-- Name: items_pkey; Type: CONSTRAINT; Schema: 1; Owner: postgrest_test; Tablespace:
--
ALTER TABLE ONLY items
@@ -589,18 +589,18 @@ ALTER TABLE ONLY items
--
-- TOC entry 2180 (class 2606 OID 337624)
-- Name: menagerie_pkey; Type: CONSTRAINT; Schema: 1; Owner: dbapi_test; Tablespace:
-- Name: menagerie_pkey; Type: CONSTRAINT; Schema: 1; Owner: postgrest_test; Tablespace:
--
ALTER TABLE ONLY menagerie
ADD CONSTRAINT menagerie_pkey PRIMARY KEY ("integer");
SET search_path = dbapi, pg_catalog;
SET search_path = postgrest, pg_catalog;
--
-- TOC entry 2184 (class 2606 OID 337626)
-- Name: auth_pkey; Type: CONSTRAINT; Schema: dbapi; Owner: dbapi_test; Tablespace:
-- Name: auth_pkey; Type: CONSTRAINT; Schema: postgrest; Owner: postgrest_test; Tablespace:
--
ALTER TABLE ONLY auth
@@ -611,18 +611,18 @@ SET search_path = private, pg_catalog;
--
-- TOC entry 2186 (class 2606 OID 337628)
-- Name: articles_pkey; Type: CONSTRAINT; Schema: private; Owner: dbapi_test; Tablespace:
-- Name: articles_pkey; Type: CONSTRAINT; Schema: private; Owner: postgrest_test; Tablespace:
--
ALTER TABLE ONLY articles
ADD CONSTRAINT articles_pkey PRIMARY KEY (id);
SET search_path = dbapi, pg_catalog;
SET search_path = postgrest, pg_catalog;
--
-- TOC entry 2189 (class 2620 OID 337630)
-- Name: ensure_auth_role_exists; Type: TRIGGER; Schema: dbapi; Owner: dbapi_test
-- Name: ensure_auth_role_exists; Type: TRIGGER; Schema: postgrest; Owner: postgrest_test
--
CREATE CONSTRAINT TRIGGER ensure_auth_role_exists AFTER INSERT OR UPDATE ON auth NOT DEFERRABLE INITIALLY IMMEDIATE FOR EACH ROW EXECUTE PROCEDURE check_role_exists();
@@ -632,17 +632,17 @@ SET search_path = private, pg_catalog;
--
-- TOC entry 2190 (class 2620 OID 337631)
-- Name: articles_owner_track; Type: TRIGGER; Schema: private; Owner: dbapi_test
-- Name: articles_owner_track; Type: TRIGGER; Schema: private; Owner: postgrest_test
--
CREATE TRIGGER articles_owner_track BEFORE INSERT OR UPDATE ON articles FOR EACH ROW EXECUTE PROCEDURE dbapi.update_owner();
CREATE TRIGGER articles_owner_track BEFORE INSERT OR UPDATE ON articles FOR EACH ROW EXECUTE PROCEDURE postgrest.update_owner();
SET search_path = "1", pg_catalog;
--
-- TOC entry 2187 (class 2606 OID 337632)
-- Name: has_fk_fk_fkey; Type: FK CONSTRAINT; Schema: 1; Owner: dbapi_test
-- Name: has_fk_fk_fkey; Type: FK CONSTRAINT; Schema: 1; Owner: postgrest_test
--
ALTER TABLE ONLY has_fk
@@ -651,7 +651,7 @@ ALTER TABLE ONLY has_fk
--
-- TOC entry 2188 (class 2606 OID 337637)
-- Name: has_fk_simple_fk_fkey; Type: FK CONSTRAINT; Schema: 1; Owner: dbapi_test
-- Name: has_fk_simple_fk_fkey; Type: FK CONSTRAINT; Schema: 1; Owner: postgrest_test
--
ALTER TABLE ONLY has_fk
@@ -661,26 +661,26 @@ ALTER TABLE ONLY has_fk
--
-- TOC entry 2317 (class 0 OID 0)
-- Dependencies: 20
-- Name: 1; Type: ACL; Schema: -; Owner: dbapi_test
-- Name: 1; Type: ACL; Schema: -; Owner: postgrest_test
--
REVOKE ALL ON SCHEMA "1" FROM PUBLIC;
REVOKE ALL ON SCHEMA "1" FROM dbapi_test;
GRANT ALL ON SCHEMA "1" TO dbapi_test;
GRANT USAGE ON SCHEMA "1" TO dbapi_anonymous;
GRANT USAGE ON SCHEMA "1" TO dbapi_test_author;
REVOKE ALL ON SCHEMA "1" FROM postgrest_test;
GRANT ALL ON SCHEMA "1" TO postgrest_test;
GRANT USAGE ON SCHEMA "1" TO postgrest_anonymous;
GRANT USAGE ON SCHEMA "1" TO postgrest_test_author;
--
-- TOC entry 2318 (class 0 OID 0)
-- Dependencies: 19
-- Name: dbapi; Type: ACL; Schema: -; Owner: dbapi_test
-- Name: postgrest; Type: ACL; Schema: -; Owner: postgrest_test
--
REVOKE ALL ON SCHEMA dbapi FROM PUBLIC;
REVOKE ALL ON SCHEMA dbapi FROM dbapi_test;
GRANT ALL ON SCHEMA dbapi TO dbapi_test;
GRANT USAGE ON SCHEMA dbapi TO dbapi_anonymous;
REVOKE ALL ON SCHEMA postgrest FROM PUBLIC;
REVOKE ALL ON SCHEMA postgrest FROM postgrest_test;
GRANT ALL ON SCHEMA postgrest TO postgrest_test;
GRANT USAGE ON SCHEMA postgrest TO postgrest_anonymous;
--
@@ -697,127 +697,127 @@ GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- TOC entry 2322 (class 0 OID 0)
-- Dependencies: 191
-- Name: authors_only; Type: ACL; Schema: 1; Owner: dbapi_test_author
-- Name: authors_only; Type: ACL; Schema: 1; Owner: postgrest_test_author
--
REVOKE ALL ON TABLE authors_only FROM PUBLIC;
REVOKE ALL ON TABLE authors_only FROM dbapi_test_author;
GRANT ALL ON TABLE authors_only TO dbapi_test_author;
REVOKE ALL ON TABLE authors_only FROM postgrest_test_author;
GRANT ALL ON TABLE authors_only TO postgrest_test_author;
--
-- TOC entry 2323 (class 0 OID 0)
-- Dependencies: 192
-- Name: auto_incrementing_pk; Type: ACL; Schema: 1; Owner: dbapi_test
-- Name: auto_incrementing_pk; Type: ACL; Schema: 1; Owner: postgrest_test
--
REVOKE ALL ON TABLE auto_incrementing_pk FROM PUBLIC;
REVOKE ALL ON TABLE auto_incrementing_pk FROM dbapi_test;
GRANT ALL ON TABLE auto_incrementing_pk TO dbapi_test;
GRANT ALL ON TABLE auto_incrementing_pk TO dbapi_anonymous;
REVOKE ALL ON TABLE auto_incrementing_pk FROM postgrest_test;
GRANT ALL ON TABLE auto_incrementing_pk TO postgrest_test;
GRANT ALL ON TABLE auto_incrementing_pk TO postgrest_anonymous;
--
-- TOC entry 2325 (class 0 OID 0)
-- Dependencies: 193
-- Name: auto_incrementing_pk_id_seq; Type: ACL; Schema: 1; Owner: dbapi_test
-- Name: auto_incrementing_pk_id_seq; Type: ACL; Schema: 1; Owner: postgrest_test
--
REVOKE ALL ON SEQUENCE auto_incrementing_pk_id_seq FROM PUBLIC;
REVOKE ALL ON SEQUENCE auto_incrementing_pk_id_seq FROM dbapi_test;
GRANT ALL ON SEQUENCE auto_incrementing_pk_id_seq TO dbapi_test;
GRANT USAGE ON SEQUENCE auto_incrementing_pk_id_seq TO dbapi_anonymous;
REVOKE ALL ON SEQUENCE auto_incrementing_pk_id_seq FROM postgrest_test;
GRANT ALL ON SEQUENCE auto_incrementing_pk_id_seq TO postgrest_test;
GRANT USAGE ON SEQUENCE auto_incrementing_pk_id_seq TO postgrest_anonymous;
--
-- TOC entry 2326 (class 0 OID 0)
-- Dependencies: 194
-- Name: compound_pk; Type: ACL; Schema: 1; Owner: dbapi_test
-- Name: compound_pk; Type: ACL; Schema: 1; Owner: postgrest_test
--
REVOKE ALL ON TABLE compound_pk FROM PUBLIC;
REVOKE ALL ON TABLE compound_pk FROM dbapi_test;
GRANT ALL ON TABLE compound_pk TO dbapi_test;
GRANT ALL ON TABLE compound_pk TO dbapi_anonymous;
REVOKE ALL ON TABLE compound_pk FROM postgrest_test;
GRANT ALL ON TABLE compound_pk TO postgrest_test;
GRANT ALL ON TABLE compound_pk TO postgrest_anonymous;
REVOKE ALL ON TABLE has_fk FROM PUBLIC;
REVOKE ALL ON TABLE has_fk FROM dbapi_test;
GRANT ALL ON TABLE has_fk TO dbapi_test;
GRANT ALL ON TABLE has_fk TO dbapi_anonymous;
REVOKE ALL ON TABLE has_fk FROM postgrest_test;
GRANT ALL ON TABLE has_fk TO postgrest_test;
GRANT ALL ON TABLE has_fk TO postgrest_anonymous;
--
-- TOC entry 2328 (class 0 OID 0)
-- Dependencies: 197
-- Name: items; Type: ACL; Schema: 1; Owner: dbapi_test
-- Name: items; Type: ACL; Schema: 1; Owner: postgrest_test
--
REVOKE ALL ON TABLE items FROM PUBLIC;
REVOKE ALL ON TABLE items FROM dbapi_test;
GRANT ALL ON TABLE items TO dbapi_test;
GRANT ALL ON TABLE items TO dbapi_anonymous;
REVOKE ALL ON TABLE items FROM postgrest_test;
GRANT ALL ON TABLE items TO postgrest_test;
GRANT ALL ON TABLE items TO postgrest_anonymous;
--
-- TOC entry 2330 (class 0 OID 0)
-- Dependencies: 198
-- Name: items_id_seq; Type: ACL; Schema: 1; Owner: dbapi_test
-- Name: items_id_seq; Type: ACL; Schema: 1; Owner: postgrest_test
--
REVOKE ALL ON SEQUENCE items_id_seq FROM PUBLIC;
REVOKE ALL ON SEQUENCE items_id_seq FROM dbapi_test;
GRANT ALL ON SEQUENCE items_id_seq TO dbapi_test;
GRANT USAGE ON SEQUENCE items_id_seq TO dbapi_anonymous;
REVOKE ALL ON SEQUENCE items_id_seq FROM postgrest_test;
GRANT ALL ON SEQUENCE items_id_seq TO postgrest_test;
GRANT USAGE ON SEQUENCE items_id_seq TO postgrest_anonymous;
--
-- TOC entry 2331 (class 0 OID 0)
-- Dependencies: 199
-- Name: menagerie; Type: ACL; Schema: 1; Owner: dbapi_test
-- Name: menagerie; Type: ACL; Schema: 1; Owner: postgrest_test
--
REVOKE ALL ON TABLE menagerie FROM PUBLIC;
REVOKE ALL ON TABLE menagerie FROM dbapi_test;
GRANT ALL ON TABLE menagerie TO dbapi_test;
GRANT ALL ON TABLE menagerie TO dbapi_anonymous;
REVOKE ALL ON TABLE menagerie FROM postgrest_test;
GRANT ALL ON TABLE menagerie TO postgrest_test;
GRANT ALL ON TABLE menagerie TO postgrest_anonymous;
--
-- TOC entry 2332 (class 0 OID 0)
-- Dependencies: 200
-- Name: no_pk; Type: ACL; Schema: 1; Owner: dbapi_test
-- Name: no_pk; Type: ACL; Schema: 1; Owner: postgrest_test
--
REVOKE ALL ON TABLE no_pk FROM PUBLIC;
REVOKE ALL ON TABLE no_pk FROM dbapi_test;
GRANT ALL ON TABLE no_pk TO dbapi_test;
GRANT ALL ON TABLE no_pk TO dbapi_anonymous;
REVOKE ALL ON TABLE no_pk FROM postgrest_test;
GRANT ALL ON TABLE no_pk TO postgrest_test;
GRANT ALL ON TABLE no_pk TO postgrest_anonymous;
--
-- TOC entry 2333 (class 0 OID 0)
-- Dependencies: 201
-- Name: simple_pk; Type: ACL; Schema: 1; Owner: dbapi_test
-- Name: simple_pk; Type: ACL; Schema: 1; Owner: postgrest_test
--
REVOKE ALL ON TABLE simple_pk FROM PUBLIC;
REVOKE ALL ON TABLE simple_pk FROM dbapi_test;
GRANT ALL ON TABLE simple_pk TO dbapi_test;
GRANT ALL ON TABLE simple_pk TO dbapi_anonymous;
REVOKE ALL ON TABLE simple_pk FROM postgrest_test;
GRANT ALL ON TABLE simple_pk TO postgrest_test;
GRANT ALL ON TABLE simple_pk TO postgrest_anonymous;
SET search_path = dbapi, pg_catalog;
SET search_path = postgrest, pg_catalog;
--
-- TOC entry 2334 (class 0 OID 0)
-- Dependencies: 202
-- Name: auth; Type: ACL; Schema: dbapi; Owner: dbapi_test
-- Name: auth; Type: ACL; Schema: postgrest; Owner: postgrest_test
--
REVOKE ALL ON TABLE auth FROM PUBLIC;
REVOKE ALL ON TABLE auth FROM dbapi_test;
GRANT ALL ON TABLE auth TO dbapi_test;
GRANT INSERT ON TABLE auth TO dbapi_anonymous;
REVOKE ALL ON TABLE auth FROM postgrest_test;
GRANT ALL ON TABLE auth TO postgrest_test;
GRANT INSERT ON TABLE auth TO postgrest_anonymous;
SET search_path = private, pg_catalog;
@@ -825,12 +825,12 @@ SET search_path = private, pg_catalog;
--
-- TOC entry 2335 (class 0 OID 0)
-- Dependencies: 203
-- Name: articles; Type: ACL; Schema: private; Owner: dbapi_test
-- Name: articles; Type: ACL; Schema: private; Owner: postgrest_test
--
REVOKE ALL ON TABLE articles FROM PUBLIC;
REVOKE ALL ON TABLE articles FROM dbapi_test;
GRANT ALL ON TABLE articles TO dbapi_test;
REVOKE ALL ON TABLE articles FROM postgrest_test;
GRANT ALL ON TABLE articles TO postgrest_test;
-- Completed on 2014-10-21 15:12:44 PDT