File obs-server-2.9-0025-ci-Nomalise-schema-files-more-before-comparing-them.patch of Package obs-server
From 007393b1022614753e7b1f784bc4bdffc02993d3 Mon Sep 17 00:00:00 2001
From: Oleg Girko <ol@infoserver.lv>
Date: Sat, 11 Aug 2018 20:23:51 +0100
Subject: [PATCH] [ci] Nomalise schema files more before comparing them.
This is needed to adapt to slight changes of database dump syntax
between different versions of MySQL / MariaDB.
Signed-off-by: Oleg Girko <ol@infoserver.lv>
---
src/api/script/compare_structure_sql.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/api/script/compare_structure_sql.sh b/src/api/script/compare_structure_sql.sh
index 7ebf1aebdd..854e02f19e 100755
--- a/src/api/script/compare_structure_sql.sh
+++ b/src/api/script/compare_structure_sql.sh
@@ -15,6 +15,9 @@ for file in "$git_file" "$migrate_file"; do
sed -i -e '/^(.21.),$/,/^(.9.);/d' "${file}.normalized" || exit 1
# we have a different last migration, therefore ; => ,
sed -i -e 's/\(^(.20.............)\);$/\1,/' "${file}.normalized" || exit 1
+ # changes for differences in MySQL / MariaDB versions behaviour
+ sed -i -e "s/ DEFAULT '\([0-9][0-9]*\)',\$/ DEFAULT \1,/" "${file}.normalized" || exit 1
+ sed -i -e 's/ DEFAULT NULL,$/,/' "${file}.normalized" || exit 1
done
if ! diff "${git_file}.normalized" "${migrate_file}.normalized"; then
--
2.20.1