File obs-server-2.10-0035-ci-Change-shortened-index-name-to-expected-one.patch of Package obs-server

From 23066c786e837837a2cdd6c56c523809ffc212d7 Mon Sep 17 00:00:00 2001
From: Oleg Girko <ol@infoserver.lv>
Date: Mon, 28 Jun 2021 00:29:05 +0100
Subject: [PATCH] [ci] Change shortened index name to expected one.

Rails 6.1 create one index with shorter name than expected
during migrations.

This change makes the script that compares database schema files
change this name to expected one to prevent comparison failure.

Signed-off-by: Oleg Girko <ol@infoserver.lv>
---
 src/api/script/compare_structure_sql.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/api/script/compare_structure_sql.sh b/src/api/script/compare_structure_sql.sh
index 894c474f34..1615141b5c 100755
--- a/src/api/script/compare_structure_sql.sh
+++ b/src/api/script/compare_structure_sql.sh
@@ -28,6 +28,8 @@ for file in "$git_file" "$migrate_file"; do
 
   # Don't distinguish between text and mediumtext
   sed -r -i "s/(\`[a-zA-Z0-9_]*\`) mediumtext/\1 text/g" "${file}.normalized" || exit 1
+  # Change shortened index name to expected one
+  sed -r -i 's/KEY `index_status_reports_on_checkable`/KEY `index_status_reports_on_checkable_type_and_checkable_id`/' "${file}.normalized" || exit 1
 done
 
 if ! diff "${git_file}.normalized" "${migrate_file}.normalized"; then
-- 
2.31.1