Skip to content

Commit

Permalink
Add BEGIN and COMMIT in sql
Browse files Browse the repository at this point in the history
  • Loading branch information
pdrillin committed Jul 23, 2021
1 parent 86a81e6 commit 0e64d0c
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gestion_base_adresse/install/sql/adresse/10_FUNCTION.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BEGIN;
--
-- PostgreSQL database dump
--
Expand Down Expand Up @@ -610,3 +611,5 @@ $$;
-- PostgreSQL database dump complete
--


COMMIT;
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BEGIN;
--
-- PostgreSQL database dump
--
Expand Down Expand Up @@ -404,3 +405,5 @@ ALTER TABLE ONLY adresse.voie ALTER COLUMN id_voie SET DEFAULT nextval('adresse.
-- PostgreSQL database dump complete
--


COMMIT;
3 changes: 3 additions & 0 deletions gestion_base_adresse/install/sql/adresse/30_VIEW.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BEGIN;
--
-- PostgreSQL database dump
--
Expand Down Expand Up @@ -149,3 +150,5 @@ CREATE VIEW adresse.v_point_adresse AS
-- PostgreSQL database dump complete
--


COMMIT;
3 changes: 3 additions & 0 deletions gestion_base_adresse/install/sql/adresse/40_INDEX.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BEGIN;
--
-- PostgreSQL database dump
--
Expand Down Expand Up @@ -82,3 +83,5 @@ CREATE INDEX voie_geom_idx ON adresse.voie USING gist (geom);
-- PostgreSQL database dump complete
--


COMMIT;
3 changes: 3 additions & 0 deletions gestion_base_adresse/install/sql/adresse/50_TRIGGER.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BEGIN;
--
-- PostgreSQL database dump
--
Expand Down Expand Up @@ -100,3 +101,5 @@ CREATE TRIGGER voie_get_commune AFTER INSERT ON adresse.voie FOR EACH ROW EXECUT
-- PostgreSQL database dump complete
--


COMMIT;
3 changes: 3 additions & 0 deletions gestion_base_adresse/install/sql/adresse/60_CONSTRAINT.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BEGIN;
--
-- PostgreSQL database dump
--
Expand Down Expand Up @@ -127,3 +128,5 @@ ALTER TABLE ONLY adresse.referencer_com
-- PostgreSQL database dump complete
--


COMMIT;
3 changes: 3 additions & 0 deletions gestion_base_adresse/install/sql/adresse/70_COMMENT.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BEGIN;
--
-- PostgreSQL database dump
--
Expand Down Expand Up @@ -268,3 +269,5 @@ COMMENT ON COLUMN adresse.voie.geom IS 'Géométrie de l’objet';
-- PostgreSQL database dump complete
--


COMMIT;
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ for ITEM in FUNCTION "TABLE|SEQUENCE|DEFAULT" VIEW INDEX TRIGGER CONSTRAINT COMM
rm "$OUTDIR/$ITEM";
# Simplify comments inside SQL files
perl -i -0pe 's/\n--\n-- Name: (TABLE )?(COLUMN )?(.+); Type:.+\n--\n\n/\n-- $3\n/g' "$OUTDIR"/"$I"_"$ITEM".sql;
echo '\nCOMMIT;' >> "$OUTDIR"/"$I"_"$ITEM".sql;
sed -i '1s/^/BEGIN;\n/' "$OUTDIR"/"$I"_"$ITEM".sql;
# Remove audit trigger (added afterwards)
if [ $ITEM = 'TRIGGER' ]
then
Expand Down

0 comments on commit 0e64d0c

Please sign in to comment.