Public schema table embedding (#803)
* Alter fixture to test objects in public schema Properly erase and restore the public schema -- requires permissions to install pgcrypto each time. * Test for fks through public schema tables * Thanks @fab1an
This commit is contained in:
Vendored
+2
-2
@@ -1,3 +1,3 @@
|
||||
set client_min_messages to warning;
|
||||
DROP SCHEMA IF EXISTS test, private, postgrest, jwt, تست CASCADE;
|
||||
DROP TYPE IF EXISTS jwt_token CASCADE;
|
||||
DROP SCHEMA IF EXISTS test, private, postgrest, jwt, public, تست CASCADE;
|
||||
DROP TYPE IF EXISTS jwt_token CASCADE;
|
||||
|
||||
Vendored
+5
@@ -3,6 +3,7 @@ GRANT USAGE ON SCHEMA
|
||||
postgrest
|
||||
, test
|
||||
, jwt
|
||||
, public
|
||||
, "تست"
|
||||
TO postgrest_test_anonymous;
|
||||
|
||||
@@ -44,6 +45,10 @@ GRANT ALL ON TABLE
|
||||
, "موارد"
|
||||
, addresses
|
||||
, orders
|
||||
, public.public_consumers
|
||||
, public.public_orders
|
||||
, consumers_view
|
||||
, orders_view
|
||||
TO postgrest_test_anonymous;
|
||||
|
||||
GRANT INSERT ON TABLE insertonly TO postgrest_test_anonymous;
|
||||
|
||||
Vendored
+1
-1
@@ -4,4 +4,4 @@ CREATE ROLE postgrest_test_anonymous;
|
||||
CREATE ROLE postgrest_test_default_role;
|
||||
CREATE ROLE postgrest_test_author;
|
||||
|
||||
GRANT postgrest_test_anonymous, postgrest_test_default_role, postgrest_test_author TO :USER;
|
||||
GRANT postgrest_test_anonymous, postgrest_test_default_role, postgrest_test_author TO :USER;
|
||||
|
||||
Vendored
+25
-23
@@ -12,31 +12,10 @@ SET standard_conforming_strings = on;
|
||||
SET check_function_bodies = false;
|
||||
SET client_min_messages = warning;
|
||||
|
||||
--
|
||||
-- Name: postgrest; Type: SCHEMA; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
CREATE SCHEMA public;
|
||||
CREATE SCHEMA postgrest;
|
||||
|
||||
|
||||
--
|
||||
-- Name: private; Type: SCHEMA; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
CREATE SCHEMA private;
|
||||
|
||||
|
||||
--
|
||||
-- Name: test; Type: SCHEMA; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
CREATE SCHEMA test;
|
||||
|
||||
|
||||
--
|
||||
-- Name: تست; Type: SCHEMA; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
CREATE SCHEMA تست;
|
||||
|
||||
|
||||
@@ -48,11 +27,13 @@ CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
||||
|
||||
SET search_path = public, pg_catalog;
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
|
||||
--
|
||||
-- Name: jwt_token; Type: TYPE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TYPE jwt_token AS (
|
||||
CREATE TYPE public.jwt_token AS (
|
||||
token text
|
||||
);
|
||||
|
||||
@@ -142,6 +123,19 @@ CREATE FUNCTION always_true(test.items) RETURNS boolean
|
||||
AS $$ SELECT true $$;
|
||||
|
||||
|
||||
create table public_consumers (
|
||||
id serial not null unique,
|
||||
name text not null check (name <> ''),
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
create table public_orders (
|
||||
id serial not null unique,
|
||||
consumer integer not null references public_consumers(id),
|
||||
number integer not null,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
--
|
||||
-- Name: anti_id(test.items); Type: FUNCTION; Schema: public; Owner: -
|
||||
--
|
||||
@@ -161,6 +155,14 @@ CREATE TABLE موارد (
|
||||
|
||||
SET search_path = test, pg_catalog;
|
||||
|
||||
|
||||
create view orders_view as
|
||||
select * from public.public_orders;
|
||||
|
||||
create view consumers_view as
|
||||
select * from public.public_consumers;
|
||||
|
||||
|
||||
--
|
||||
-- Name: getitemrange(bigint, bigint); Type: FUNCTION; Schema: test; Owner: -
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user