21031: Fixes post installation script for rails applications. 21031-test-provision-fix
authorLucas Di Pentima <lucas.dipentima@curii.com>
Thu, 9 Nov 2023 19:10:19 +0000 (16:10 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Thu, 9 Nov 2023 19:10:19 +0000 (16:10 -0300)
Set up schema files ownership in the same way without regards on the
rake task used: db:schema:load or db:structure:load (deprecated).

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

build/rails-package-scripts/postinst.sh

index f6ae48c0fc4e9373be9d3756698016f28f64493d..e317f85aaff27ac246885c76263ed5365d75cbc2 100644 (file)
@@ -218,8 +218,11 @@ configure_version() {
   # Make sure postgres doesn't try to use a pager.
   export PAGER=
   case "$RAILSPKG_DATABASE_LOAD_TASK" in
-      db:schema:load) chown "$WWW_OWNER:" $RELEASE_PATH/db/schema.rb ;;
-      db:structure:load) chown "$WWW_OWNER:" $RELEASE_PATH/db/structure.sql ;;
+      # db:structure:load was deprecated in Rails 6.1 and shouldn't be used.
+      db:schema:load | db:structure:load)
+          chown "$WWW_OWNER:" $RELEASE_PATH/db/schema.rb || true
+          chown "$WWW_OWNER:" $RELEASE_PATH/db/structure.sql || true
+          ;;
   esac
   chmod 644 $SHARED_PATH/log/*
   chmod -R 2775 $RELEASE_PATH/tmp || true