From d1d83e03272ad439c427054344b6f7f6a5bf26c1 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 20 Jun 2023 07:51:40 +0200 Subject: [PATCH] Database creation: add unaccent postgresql extension. Tests unitaires OK. --- sco_version.py | 2 +- tests/api/test_api_permissions.py | 1 + tools/create_database.sh | 2 +- tools/debian/postinst | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sco_version.py b/sco_version.py index 7a95f76a5..857492bf1 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.4.87" +SCOVERSION = "9.4.88" SCONAME = "ScoDoc" diff --git a/tests/api/test_api_permissions.py b/tests/api/test_api_permissions.py index 70d214467..9a5ff9acb 100644 --- a/tests/api/test_api_permissions.py +++ b/tests/api/test_api_permissions.py @@ -60,6 +60,7 @@ def test_permissions(api_headers): "role_name": "Ens", "start": "abc", "uid": 1, + "validation_id": 1, "version": "long", } for rule in api_rules: diff --git a/tools/create_database.sh b/tools/create_database.sh index 6e9a939ed..d2863722b 100755 --- a/tools/create_database.sh +++ b/tools/create_database.sh @@ -31,4 +31,4 @@ source "$SCRIPT_DIR"/utils.sh || die "config.sh not found, exiting" # --- echo 'Creating postgresql database ' "$db_name" createdb -E UTF-8 -p "$POSTGRES_PORT" -O "$POSTGRES_USER" "$db_name" - +echo 'CREATE EXTENSION IF NOT EXISTS "unaccent";' | psql -p "$POSTGRES_PORT" "$db_name" "$POSTGRES_USER" diff --git a/tools/debian/postinst b/tools/debian/postinst index dad8205ee..c967a53ec 100755 --- a/tools/debian/postinst +++ b/tools/debian/postinst @@ -104,7 +104,7 @@ if [ "$n" == 1 ] then echo "Upgrading existing SCODOC database..." # Ajout extension unaccent (postgres superuser, ajout sur base SCODOC) - (cd /tmp; echo 'CREATE EXTENSION IF NOT EXISTS "unaccent";' | su -c psql postgres) + (cd /tmp; echo 'CREATE EXTENSION IF NOT EXISTS "unaccent";' | su -c "psql SCODOC" postgres) # Migrations gérées avec Flask-Migrate (Alembic/SQLAlchemy) # utilise les scripts dans migrations/version/ # pour mettre à jour notre base (en tant qu'utilisateur scodoc)