Skip to content
Snippets Groups Projects
Commit 997c281b authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '389-use-database-migration-framework' into 'master'

fresh install of debian package uses flyway

Closes #389

See merge request !368
parents 648100e2 1c4b73d9
No related branches found
No related tags found
1 merge request!368fresh install of debian package uses flyway
Pipeline #
Showing
with 2 additions and 10 deletions
...@@ -41,9 +41,6 @@ mkdir $SRC_DIR ...@@ -41,9 +41,6 @@ mkdir $SRC_DIR
#copy war file #copy war file
cp $TOMCAT_FILE $SRC_DIR/minerva.war cp $TOMCAT_FILE $SRC_DIR/minerva.war
#copy base sql schema
cp $DB_SCHEMA_DIR/base.sql $SRC_DIR/db_0.sql
#copy manual documentation #copy manual documentation
cp $DOC_DIR/description.txt $SRC_DIR/minerva.txt cp $DOC_DIR/description.txt $SRC_DIR/minerva.txt
gzip -n $SRC_DIR/minerva.txt gzip -n $SRC_DIR/minerva.txt
...@@ -134,7 +131,6 @@ sed -i -e "1r common.sh" debian/prerm ...@@ -134,7 +131,6 @@ 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 #put scripts into $DB_SCRIPT_DIR (it's a bit different than varaiable because it's not
#escaped #escaped
echo db_0.sql /usr/share\/minerva/schema >> debian/install
echo db_0_to_$MAX_DB_VERSION_FOR_MIGRTION".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[*]} for version in ${versions[*]}
do do
......
...@@ -27,12 +27,6 @@ case "$1" in ...@@ -27,12 +27,6 @@ case "$1" in
if [ "$OLD_VERSION" = "" ] if [ "$OLD_VERSION" = "" ]
then then
create_db create_db
#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_${MAX_DB_VERSION_FOR_MIGRTION}.sql"
else else
#if we update the package #if we update the package
if [ -f $DB_SCRIPT_DIR/db_${OLD_VERSION}_to_${MAX_DB_VERSION_FOR_MIGRTION}.sql ]; then if [ -f $DB_SCRIPT_DIR/db_${OLD_VERSION}_to_${MAX_DB_VERSION_FOR_MIGRTION}.sql ]; then
......
...@@ -26,6 +26,7 @@ public class CustomDatabasePopulator implements DatabasePopulator { ...@@ -26,6 +26,7 @@ public class CustomDatabasePopulator implements DatabasePopulator {
Flyway flyway = new Flyway(); Flyway flyway = new Flyway();
flyway.setDataSource(url, user, password); flyway.setDataSource(url, user, password);
flyway.setBaselineVersionAsString("12.1.0"); flyway.setBaselineVersionAsString("12.1.0");
flyway.setOutOfOrder(true);
flyway.setBaselineOnMigrate(true); flyway.setBaselineOnMigrate(true);
flyway.migrate(); flyway.migrate();
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
<bean id="startupScripts" class="org.springframework.jdbc.datasource.init.DataSourceInitializer"> <bean id="startupScripts" class="org.springframework.jdbc.datasource.init.DataSourceInitializer">
<property name="dataSource"><ref bean="DataSource"/></property> <property name="dataSource"><ref bean="DataSource"/></property>
<property name="databasePopulator"><ref bean="DbInit"/></property> <property name="databasePopulator"><ref bean="DbInit"/></property>
<property name="enabled" value="true"/>
</bean> </bean>
</beans> </beans>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment