Commit fec4aab5 authored by Julie gauthier's avatar Julie gauthier
Browse files

Merge branch...

Merge branch '631-sql-file-create-tables-and-procedures-should-not-contain-any-privilege-containt' into 'develop'

Resolve "SQL file Create tables and procedures should not contain any privilege containt"

Closes #631

See merge request !221
parents 41755f36 df28d44a
Pipeline #2501 passed with stage
in 1 minute and 36 seconds
......@@ -170,7 +170,7 @@ psql -U comptoir -W comptoir_test
## POSTGRESQL Create tables and procedures
As any user, do :
As user `comptoir`, do :
```shell
/home/comptoir/Comptoir-srv/bin/COMPTOIR_create_DB_tables_and_procedures.sh -d /home/comptoir/Comptoir-srv
......
# Database schema upgrade HOWTO
In case of database schema modification from one version to another one, you will have to do `pgdump`
and place the result in `config/SQL/COMPTOIR_DB_create_tables_and_procedures.sql`.
This if fine.
BUT, as this file is meant to be run by a non-privileged user (comptoir), you'll have to remove all
SQL commands requiring privileges. As a record, those commands are all placed in
`config/SQL/COMPTOIR_DB_create_database_and_set_ownership.sql` (which is run as root).
So you'll have to *manually* remove the following statements :
* at the beginning of the file:
* all statements before the `\connect comptoir` statement, including the `\connect comptoir` statement
* statement `CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;`
* statement `COMMENT ON EXTENSION plpgsql
IS 'PL/pgSQL procedural language';`
* at the end of the file, the four statements:
`REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC`
......@@ -16,42 +16,6 @@ SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
DROP DATABASE IF EXISTS comptoir;
--
-- Name: comptoir; Type: DATABASE; Schema: -; Owner: comptoir
--
CREATE DATABASE comptoir WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'fr_FR.UTF-8' LC_CTYPE = 'fr_FR.UTF-8';
ALTER DATABASE comptoir
OWNER TO comptoir;
\connect comptoir
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql
IS 'PL/pgSQL procedural language';
--
-- Name: calculate_score_for_softwares_statistics(); Type: FUNCTION; Schema: public; Owner: comptoir
--
......@@ -1956,15 +1920,6 @@ ALTER TABLE ONLY public.softwares_tags
ALTER TABLE ONLY public.softwares_tags
ADD CONSTRAINT softwares_tags_tag_id FOREIGN KEY (tag_id) REFERENCES public.tags (id) ON UPDATE CASCADE ON DELETE CASCADE;
--
-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: postgres
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment