Commit c9cf5579 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

debian package doesn't migrate sql files that are managed by flyway

parent addc6a67
minerva (12.1.0~alpha.0) experimental; urgency=medium
* Feature: genome browser with gene variants
* Feature: support of all CellDesigner element modifications
* Feature: ldap authentication
* Feature: multicolored anchors for data overlays
* Bug fix: annotations for elements with mutation in name (like "BID (p15)")
weren't provided properly
* Small improvement: annotations from RHEA are handled
* Small improvement: description of a grouped results in improved
* Small improvement: selection of required annotation on map upload improved
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 25 Jul 2018 10:00:00 +0200
minerva (12.0.1) stable; urgency=medium
* Bug fix: setting default zoom level on submap
* Bug fix: opened submap had different background then current selection
......@@ -8,7 +21,7 @@ minerva (12.0.1) stable; urgency=medium
* Bug fix: map is repositioned when info window is outside of current view in
OpenLayers library
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 22 Jul 2018 10:00:00 +0200
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 24 Jul 2018 10:00:00 +0200
minerva (12.0.0) stable; urgency=medium
* Feature: There is alternative OpenLayers map engine available
......
......@@ -22,7 +22,7 @@ DOC_DIR=doc
TOMCAT_FILE=web/target/web-1.0.war
#Directory with database schema
DB_SCHEMA_DIR=persist/src/db
DB_SCHEMA_DIR=persist/src/main/resources/db/migration
ROOT_DIR=`pwd`
......@@ -46,7 +46,7 @@ cp $DB_SCHEMA_DIR/base.sql $SRC_DIR/db_0.sql
#copy manual documentation
cp $DOC_DIR/description.txt $SRC_DIR/minerva.txt
gzip $SRC_DIR/minerva.txt
gzip -n $SRC_DIR/minerva.txt
#copy configuration of logrotate
cp debian/logrotate/* $SRC_DIR/
......@@ -58,16 +58,18 @@ cp CHANGELOG $ROOT_DIR/debian/template/changelog
# set $versions and $current_version; generate upgrade scripts in SRC_DIR
DBSCRIPT_DEST_DIR=$SRC_DIR
MAX_DB_VERSION_FOR_MIGRTION=12.1.0~alpha
source $dbschemadiff
echo "Current version: " $current_version
echo "Flyway was introduced in version: " $MAX_DB_VERSION_FOR_MIGRTION
# check if the changelog contains info about new version
tmpVar=`cat debian/template/changelog | grep "minerva ($current_version)"|wc -l`
if [ $tmpVar -eq "0" ]
then
echo "Invalid changelog file. Please modify debian/template/changelog to contain information about current version";
exit 1;
e-n xit 1;
fi
......@@ -120,6 +122,7 @@ sed -i "s/__DB_PORT__/$DB_PORT/g" common.sh
sed -i "s/__DB_DATABASE_NAME__/$DB_DATABASE_NAME/g" common.sh
sed -i "s/__DB_USERNAME__/$DB_USERNAME/g" common.sh
sed -i "s/__DB_PASSWORD__/$DB_PASSWORD/g" common.sh
sed -i "s/__MAX_DB_VERSION_FOR_MIGRTION__/$MAX_DB_VERSION_FOR_MIGRTION/g" common.sh
sed -i -e "1r common.sh" debian/postinst
sed -i -e "1r common.sh" debian/postrm
......@@ -132,12 +135,12 @@ sed -i -e "1r common.sh" debian/prerm
#put scripts into $DB_SCRIPT_DIR (it's a bit different than varaiable because it's not
#escaped
echo db_0.sql /usr/share\/minerva/schema >> debian/install
echo db_0_to_$current_version".sql" /usr/share/minerva/schema >> debian/install
echo db_0_to_$MAX_DB_VERSION_FOR_MIGRTION".sql" /usr/share/minerva/schema >> debian/install
for version in ${versions[*]}
do
if [ "$version" != "$current_version" ]
then
echo db_"$version"_to_$current_version".sql" /usr/share/minerva/schema >> debian/install;
echo db_"$version"_to_$MAX_DB_VERSION_FOR_MIGRTION".sql" /usr/share/minerva/schema >> debian/install;
fi
done
......@@ -152,7 +155,8 @@ echo minerva.txt.gz /usr/share/doc/minerva/minerva.txt.gz >> debian/install;
echo minerva /etc/logrotate.d >> debian/install;
#remove some sample file
rm debian/package.doc-base.EX
rm debian/*.EX
rm debian/*.ex
#build debian package
debuild -us -uc
......
......@@ -5,6 +5,7 @@ log(){
LOG_FILE="__LOG_FILE__"
DB_SCRIPT_DIR="__DB_SCRIPT_DIR__"
MAX_DB_VERSION_FOR_MIGRTION="__MAX_DB_VERSION_FOR_MIGRTION__"
#new (current) version of the package
CURRENT_VERSION="__CURRENT_VERSION__"
......
Source: minerva
Priority: optional
Maintainer: Piotr Gawron <piotr.gawron@uni.lu>
Standards-Version: 3.9.6
Standards-Version: 3.9.7
#Vcs-Git: git://anonscm.debian.org/collab-maint/minerva.git
#Vcs-Browser: http://anonscm.debian.org/?p=collab-maint/minerva.git;a=summary
......
......@@ -31,11 +31,15 @@ case "$1" in
#install base version of the framework
exec_sql_file "$DB_SCRIPT_DIR/db_0.sql"
#install patch to current version
exec_sql_file "$DB_SCRIPT_DIR/db_0_to_${CURRENT_VERSION}.sql"
exec_sql_file "$DB_SCRIPT_DIR/db_0_to_${MAX_DB_VERSION_FOR_MIGRTION}.sql"
else
#if we update the package
exec_sql_file "$DB_SCRIPT_DIR/db_${OLD_VERSION}_to_${CURRENT_VERSION}.sql"
if [ -f $DB_SCRIPT_DIR/db_${OLD_VERSION}_to_${MAX_DB_VERSION_FOR_MIGRTION}.sql ]; then
exec_sql_file "$DB_SCRIPT_DIR/db_${OLD_VERSION}_to_${MAX_DB_VERSION_FOR_MIGRTION}.sql"
else
log "INFO: File doesn't exist: $DB_SCRIPT_DIR/db_${OLD_VERSION}_to_${MAX_DB_VERSION_FOR_MIGRTION}.sql"
fi
fi
#print a disclaimer
......
......@@ -4,8 +4,9 @@
# files)
# Precondition: the following variables have to be correctly initialised
# * DB_SCHEMA_DIR set to the directory containing database initialisation and upgrade sql commands
# * DBSCRIPT_DEST_DIR set to the directory that will be populated with database upgrade scripts
# * DB_SCHEMA_DIR set to the directory containing database initialisation and upgrade sql commands
# * DBSCRIPT_DEST_DIR set to the directory that will be populated with database upgrade scripts
# * MAX_DB_VERSION_FOR_MIGRTION set to the max version number that should be used for generating migration scripts; further version will be managed by flyway
# Postcondition:
# * versions is set to the available MINERVA versions (bash array)
......@@ -20,12 +21,22 @@ versions=();
current_version=-1;
#find all available versions
versionCompLte() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
}
versionCompLt() {
[ "$1" = "$2" ] && return 1 || versionCompLte $1 $2
}
for version in `ls "$DB_SCHEMA_DIR" | sort -V`;
do
if [ -d "$DB_SCHEMA_DIR/$version" ]
then
versions+=($version);
if versionCompLt $version $MAX_DB_VERSION_FOR_MIGRTION
then
versions+=($version);
fi
current_version=$version;
fi
done
......@@ -34,28 +45,24 @@ done
# GENERATE DB schemas and diff files
#--------------------------------------
versionCompLte() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
}
versionCompLt() {
[ "$1" = "$2" ] && return 1 || versionCompLte $1 $2
}
for version_A in ${versions[*]}
do
touch $DBSCRIPT_DEST_DIR/db_${version_A}_to_${MAX_DB_VERSION_FOR_MIGRTION}.sql
done
#last version (used for generating db diff files)
for version_A in ${versions[*]}
do
#main update file (used to create this version - it's a diff
#between base.sql and current version)
update_file="$DBSCRIPT_DEST_DIR/db_0_to_${current_version}.sql";
#between base.sql and last version not managed by flyway)
update_file="$DBSCRIPT_DEST_DIR/db_0_to_${MAX_DB_VERSION_FOR_MIGRTION}.sql";
#now iterate through all versions
for file in `ls "$DB_SCHEMA_DIR/$version_A" | sort -V`;
do
if [ -f "$DB_SCHEMA_DIR/$version_A/$file" ]
then
#add difference to current db schema diff
#add db schema diff to last version not managed by flyway
printf "\n\n-- UPDATE $version_A/$file\n\n" >> "$update_file";
cat "$DB_SCHEMA_DIR/$version_A/$file" >> "$update_file";
......@@ -67,7 +74,7 @@ do
#after #version_B (so version_A must be later)
if versionCompLt $version_B $version_A
then
upd_file="$DBSCRIPT_DEST_DIR/db_${version_B}_to_${current_version}.sql";
upd_file="$DBSCRIPT_DEST_DIR/db_${version_B}_to_${MAX_DB_VERSION_FOR_MIGRTION}.sql";
printf "\n\n-- UPDATE $version_A/$file\n\n" >> "$upd_file";
cat "$DB_SCHEMA_DIR/$version_A/$file" >> "$upd_file";
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment