Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup databases extensions in first changelog #248

Merged
merged 3 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions datamodel/.docker/init_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ recreate_db(){
psql -U postgres -d postgres -o /dev/null -c "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = '$1'"
dropdb -U postgres --if-exists $1
createdb -U postgres $1
psql -c 'CREATE EXTENSION IF NOT EXISTS postgis'
psql -c 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp"'
}

if [ "$1" == "wait" ]; then
Expand Down
3 changes: 3 additions & 0 deletions datamodel/changelogs/0001/00_db_extensions.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS hstore;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The audit is not currently bundled. I would recommend to revisit this before adding this extension. Jon(b) is generally preferred over hstore nowadays.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dropping hstore requires changes in the history viewer plugin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I am just saying that currently there is nothing in this repo related to the history viewer. It's up to the manager to add this extension, it should not be integrated by default if not use by default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was in qgep and I don't see why we should now suddenly drop it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#249 I changed the extensions here and added the history viewer needs in a separate PR.

We can always switch to jsonb when we implement it in history viewer.

This is a 1-1 functionnality with QGEP.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I make myself clear.
I approved the PR before the addition of the hstore extension, added after and merged.
I think it is a good practice to prefer dedicated PRs for each change.
We had former discussions with Arnaud where I think we decided to have this audit functionality apart from the definition of the model. To my opinion, this should be at least optional.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #249 for later comments.

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
1 change: 1 addition & 0 deletions datamodel/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/..

cd $DIR

psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -f ${DIR}/changelogs/0001/00_db_extensions.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -f ${DIR}/changelogs/0001/01_schema.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -f ${DIR}/changelogs/0001/02_sys.sql
psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -f ${DIR}/changelogs/0001/oid_generation.sql
Expand Down