Skip to content

Commit

Permalink
break the predefined requirement of the schema name being "stevedb"
Browse files Browse the repository at this point in the history
this work goes over the all migration scripts and removes every occurrence of "stevedb". now, the schema name is configurable by user. furthermore, it cleans up the initial mysql dump (V0_6_6__inital.sql). if the schema does not exist, it will be created by the flyway using the given schema name.
  • Loading branch information
goekay committed Oct 6, 2015
1 parent 664f583 commit 3eb3a9d
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 208 deletions.
8 changes: 8 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### How can I upgrade from 1.x.x to 2.x.x? ###

The major release 2.0.0 is backwards incompatible with existing installations,
since the migration scripts are manually altered (See commit message: TODO) and the checksums in the metadata
table of Flyway (our DB migration tool) need to be corrected.
This can be done executing the following command:

mvn initialize flyway:repair
11 changes: 7 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.rwth.idsg</groupId>
<artifactId>steve</artifactId>
<version>1.3.0</version>
<version>2.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<developers>
Expand Down Expand Up @@ -253,9 +253,12 @@

<configuration>
<driver>com.mysql.jdbc.Driver</driver>
<url>${db.url}</url>
<url>jdbc:mysql://${db.ip}:${db.port}/</url>
<user>${db.user}</user>
<password>${db.password}</password>
<schemas>
<schema>${db.schema}</schema>
</schemas>
<locations>
<location>filesystem:src/main/resources/db/migration</location>
</locations>
Expand Down Expand Up @@ -302,7 +305,7 @@
<configuration>
<jdbc>
<driver>com.mysql.jdbc.Driver</driver>
<url>${db.url}</url>
<url>jdbc:mysql://${db.ip}:${db.port}/</url>
<user>${db.user}</user>
<password>${db.password}</password>
</jdbc>
Expand All @@ -312,7 +315,7 @@
<name>org.jooq.util.mysql.MySQLDatabase</name>
<includes>.*</includes>
<excludes/>
<inputSchema>stevedb</inputSchema>
<inputSchema>${db.schema}</inputSchema>
<unsignedTypes>false</unsignedTypes>

<customTypes>
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/de/rwth/idsg/steve/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ private static void loadProperties() throws IOException {

STEVE_VERSION = prop.getString("steve.version");

DB.URL = prop.getString("db.url");
DB.URL = new StringBuilder("jdbc:mysql://").append(prop.getString("db.ip"))
.append(":")
.append(prop.getInt("db.port"))
.append("/")
.append(prop.getString("db.schema"))
.toString();

DB.USERNAME = prop.getString("db.user");
DB.PASSWORD = prop.getString("db.password");
DB.SQL_LOGGING = prop.getBoolean("db.sql.logging");
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/config/dev/main.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Database configuration
#
db.url = jdbc:mysql://localhost:3306/stevedb
db.ip = localhost
db.port = 3306
db.schema = stevedb
db.user = root
db.password = come47on

Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/config/prod/main.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Database configuration
#
db.url = jdbc:mysql://localhost:3306/stevedb
db.ip = localhost
db.port = 3306
db.schema = stevedb
db.user = root
db.password = come47on

Expand Down
Loading

0 comments on commit 3eb3a9d

Please sign in to comment.