← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3076: The generic installer now supports multiple database restore.

 

Merge authors:
  Bjørnar Valbø <heia@xxxxxxxx>
------------------------------------------------------------
revno: 3076 [merge]
committer: Bjørnar Valbø <heia@xxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-03-18 14:19:45 +0100
message:
  The generic installer now supports multiple database restore.
added:
  installers/resources/conf/generic_hibernate.properties
modified:
  installers/resources/postgres/restore_db_psql.bat
  installers/src/bitrock/DHIS2_pginstaller_generic.xml


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== added file 'installers/resources/conf/generic_hibernate.properties'
--- installers/resources/conf/generic_hibernate.properties	1970-01-01 00:00:00 +0000
+++ installers/resources/conf/generic_hibernate.properties	2011-03-18 13:18:45 +0000
@@ -0,0 +1,27 @@
+# H2
+
+#hibernate.dialect = org.hisp.dhis.dialect.H2Dialect
+#hibernate.connection.driver_class = org.h2.Driver
+#hibernate.connection.url = jdbc:h2:./database/demo;AUTO_SERVER=TRUE
+#hibernate.connection.username = sa
+#hibernate.connection.password =
+
+# PostgreSQL
+
+hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
+hibernate.connection.driver_class = org.postgresql.Driver
+hibernate.connection.url = jdbc:postgresql:dhis2db
+hibernate.connection.username = dhis
+hibernate.connection.password = dhis
+
+# MySQL
+
+#hibernate.dialect = org.hibernate.dialect.MySQLDialect
+#hibernate.connection.driver_class = com.mysql.jdbc.Driver
+#hibernate.connection.url = jdbc:mysql://localhost/dhis2
+#hibernate.connection.username = sa
+#hibernate.connection.password = 
+
+# General
+
+hibernate.hbm2ddl.auto = update

=== modified file 'installers/resources/postgres/restore_db_psql.bat'
--- installers/resources/postgres/restore_db_psql.bat	2011-03-17 13:01:21 +0000
+++ installers/resources/postgres/restore_db_psql.bat	2011-03-18 08:51:24 +0000
@@ -1,4 +1,13 @@
-SET PGPASSWORD=PG_PASSWORD
+SET PGPASSWORD=postgres
+SET DB_NAME=dhis2db
+SET n=2
+setlocal enabledelayedexpansion
+
 "POSTGRES_INSTALL_LOCATION\bin\psql.exe" -c "CREATE USER dhis CREATEDB LOGIN PASSWORD 'dhis';" -U postgres -w postgres
-"POSTGRES_INSTALL_LOCATION\bin\createdb.exe" -U postgres -w -O dhis dhis2db
-"POSTGRES_INSTALL_LOCATION\bin\psql.exe" -U postgres -w -d dhis2db -f "DATABASE_FILE"
\ No newline at end of file
+
+for %%X in (dhis2db\*.*) do (
+	"POSTGRES_INSTALL_LOCATION\bin\createdb.exe" -U postgres -w -O dhis !DB_NAME!
+	"POSTGRES_INSTALL_LOCATION\bin\psql.exe" -U postgres -w -d !DB_NAME! -f "%%X"
+	SET DB_NAME=%DB_NAME%!n!
+	SET /a n+=1
+)
\ No newline at end of file

=== modified file 'installers/src/bitrock/DHIS2_pginstaller_generic.xml'
--- installers/src/bitrock/DHIS2_pginstaller_generic.xml	2011-03-17 13:01:21 +0000
+++ installers/src/bitrock/DHIS2_pginstaller_generic.xml	2011-03-18 08:51:24 +0000
@@ -558,9 +558,6 @@
                     <workingDirectory>${installdir}\tmp\</workingDirectory>
                 </runProgram>
                 <deleteFile>
-                    <path>${installdir}\tmp\dhis2db.dump</path>
-                </deleteFile>
-                <deleteFile>
                     <path>${installdir}\tmp\restore_db_psql.bat</path>
                 </deleteFile>
             </postInstallationActionList>