Skip to content

Commit

Permalink
Database migration handled by Flyway, SQL scripts updated
Browse files Browse the repository at this point in the history
  • Loading branch information
kkovarik committed May 25, 2017
1 parent e06cc6b commit d460905
Show file tree
Hide file tree
Showing 19 changed files with 711 additions and 437 deletions.
Expand Up @@ -29,7 +29,8 @@ public class MutableNode extends AbstractNode {
*/
@Id
@Column(name = "node_id")
@GeneratedValue(strategy = GenerationType.AUTO)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "openhub_node_id_sequence")
@SequenceGenerator(name="openhub_node_id_sequence", sequenceName="openhub_node_sequence", allocationSize=1)
private Long nodeId;

/**
Expand Down
4 changes: 4 additions & 0 deletions core/pom.xml
Expand Up @@ -81,6 +81,10 @@
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>

<!-- misc -->
<dependency>
Expand Down
15 changes: 15 additions & 0 deletions core/src/main/resources/db/README.md
@@ -0,0 +1,15 @@
## DB migration scripts for OpenHub

* SQL schema should be handled by Flyway, which does apply all the scripts in the migration folder
with respect to the selected db engine.
* All scripts should be immutable, once added & applied, then they should not be changes. There is naming convention in place,
scripts should start with VX_X__ version, as it is default for Flyway.
* Interesting configuration properties:
```
flyway.baseline-on-migrate = (true/false)
- whether to automatically call baseline when migrate is executed against a non-empty schema with no metadata table. This schema will then
be baselined with the baselineVersion before executing the migrations. Only migrations above baselineVersion will then be applied.
```

* See flyway documentation (https://flywaydb.org/documentation/) for more information.
151 changes: 0 additions & 151 deletions core/src/main/resources/db/db_init-configuration.sql

This file was deleted.

113 changes: 0 additions & 113 deletions core/src/main/resources/db/db_schema_postgreSql.sql

This file was deleted.

68 changes: 0 additions & 68 deletions core/src/main/resources/db/db_schema_postgreSql_0_4.sql

This file was deleted.

0 comments on commit d460905

Please sign in to comment.