mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 22:13:08 +00:00
Move all Flyway SQL migrations to 'dspace-api.jar' to discourage running them manually.
This commit is contained in:
@@ -267,18 +267,22 @@ public class DatabaseUtils
|
||||
DatabaseMetaData meta = connection.getMetaData();
|
||||
// NOTE: we use "findDbKeyword()" here as it won't cause
|
||||
// DatabaseManager.initialize() to be called (which in turn auto-calls Flyway)
|
||||
String scriptFolder = DatabaseManager.findDbKeyword(meta);
|
||||
String dbType = DatabaseManager.findDbKeyword(meta);
|
||||
connection.close();
|
||||
|
||||
// Determine location(s) where Flyway will load all DB migrations
|
||||
ArrayList<String> scriptLocations = new ArrayList<String>();
|
||||
|
||||
// First, add location of SQL migrations (based on DB Type)
|
||||
// First, add location for custom SQL migrations, if any (based on DB Type)
|
||||
// e.g. [dspace.dir]/etc/[dbtype]/
|
||||
scriptLocations.add("filesystem:" + ConfigurationManager.getProperty("dspace.dir") +
|
||||
"/etc/migrations/" + scriptFolder);
|
||||
"/etc/" + dbType);
|
||||
|
||||
// Next, add the Java package where Flyway will load Java migrations from
|
||||
// Also add the Java package where Flyway will load SQL migrations from (based on DB Type)
|
||||
scriptLocations.add("classpath:org.dspace.storage.rdbms.sqlmigration." + dbType);
|
||||
|
||||
// Also add the Java package where Flyway will load Java migrations from
|
||||
// NOTE: this also loads migrations from any sub-package
|
||||
scriptLocations.add("classpath:org.dspace.storage.rdbms.migration");
|
||||
|
||||
// Special scenario: If XMLWorkflows are enabled, we need to run its migration(s)
|
||||
|
@@ -9,9 +9,8 @@ By default, the DSpace Unit Testing environment configures H2 to run in
|
||||
These database migrations are automatically called by [Flyway](http://flywaydb.org/)
|
||||
when the `DatabaseManager` initializes itself (see `initializeDatabase()` method).
|
||||
|
||||
The H2 migrations in this directory are *based on* the Oracle Migrations
|
||||
(`[src]/dspace/etc/migrations/oracle/*.sql`), but with some modifications in
|
||||
order to be valid in H2.
|
||||
The H2 migrations in this directory are *based on* the Oracle Migrations, but
|
||||
with some modifications in order to be valid in H2.
|
||||
|
||||
## Oracle vs H2 script differences
|
||||
|
@@ -1,25 +1,24 @@
|
||||
# DSpace Database Now Upgrades Automatically
|
||||
|
||||
AS OF DSPACE 5.0, the DSpace database now upgrades itself AUTOMATICALLY.
|
||||
AS OF DSPACE 5, the DSpace database now upgrades itself AUTOMATICALLY.
|
||||
|
||||
Therefore, all `database_schema*.sql` files have been removed. Starting
|
||||
with DSpace 4.x -> 5.0 upgrade, you will no longer need to manually run any
|
||||
SQL scripts to upgrade your database.
|
||||
|
||||
However, if you have not yet upgraded to DSpace 4.x, YOU MUST MANUALLY DO SO.
|
||||
Those manual `database_schema*.sql` scripts can still be found in the
|
||||
DSpace 4.x source code at:
|
||||
Please see the [5.0 Upgrade Instructions](https://wiki.duraspace.org/display/DSDOC5x/Upgrading+to+5.x)
|
||||
for more information on upgrading to DSpace 5.
|
||||
|
||||
https://github.com/DSpace/DSpace/tree/dspace-4_x/dspace/etc/oracle/
|
||||
|
||||
## More info on automatic database upgrades (for developers)
|
||||
## More info on automatic database upgrades
|
||||
|
||||
As of DSpace 5.0, we now use [Flyway DB](http://flywaydb.org/) along with
|
||||
the scripts under `[dspace]/etc/migrations/oracle` to automatically keep your
|
||||
DSpace database up-to-date.
|
||||
As of DSpace 5.0, we now use [Flyway DB](http://flywaydb.org/) along with the
|
||||
SQL scripts embedded in the `dspace-api.jar` to automatically keep your DSpace
|
||||
database up-to-date. These scripts are now located in the source code at:
|
||||
`[dspace-src]/dspace-api/src/main/java/resources/org/dspace/storage/rdbms/sqlmigration/oracle`
|
||||
|
||||
As Flyway automates the upgrade process, you should NEVER run these scripts
|
||||
manually. For more information, please see the `README` in the scripts directory.
|
||||
As Flyway automates the upgrade process, you should NEVER run these SQL scripts
|
||||
manually. For more information, please see the `README.md` in the scripts directory.
|
||||
|
||||
## Using the update-sequences.sql script
|
||||
|
@@ -1,25 +1,24 @@
|
||||
# DSpace Database Now Upgrades Automatically
|
||||
|
||||
AS OF DSPACE 5.0, the DSpace database now upgrades itself AUTOMATICALLY.
|
||||
AS OF DSPACE 5, the DSpace database now upgrades itself AUTOMATICALLY.
|
||||
|
||||
Therefore, all `database_schema*.sql` files have been removed. Starting
|
||||
with DSpace 4.x -> 5.0 upgrade, you will no longer need to manually run any
|
||||
SQL scripts to upgrade your database.
|
||||
|
||||
However, if you have not yet upgraded to DSpace 4.x, YOU MUST MANUALLY DO SO.
|
||||
Those manual `database_schema*.sql` scripts can still be found in the
|
||||
DSpace 4.x source code at:
|
||||
Please see the [5.0 Upgrade Instructions](https://wiki.duraspace.org/display/DSDOC5x/Upgrading+to+5.x)
|
||||
for more information on upgrading to DSpace 5.
|
||||
|
||||
https://github.com/DSpace/DSpace/tree/dspace-4_x/dspace/etc/postgres/
|
||||
|
||||
## More info on automatic database upgrades
|
||||
|
||||
As of DSpace 5.0, we now use [Flyway DB](http://flywaydb.org/) along with
|
||||
the scripts under `[dspace]/etc/migrations/oracle` to automatically keep your
|
||||
DSpace database up-to-date.
|
||||
As of DSpace 5.0, we now use [Flyway DB](http://flywaydb.org/) along with the
|
||||
SQL scripts embedded in the `dspace-api.jar` to automatically keep your DSpace
|
||||
database up-to-date. These scripts are now located in the source code at:
|
||||
`[dspace-src]/dspace-api/src/main/java/resources/org/dspace/storage/rdbms/sqlmigration/postgres`
|
||||
|
||||
As Flyway automates the upgrade process, you should NEVER run these scripts
|
||||
manually. For more information, please see the `README` in the scripts directory.
|
||||
As Flyway automates the upgrade process, you should NEVER run these SQL scripts
|
||||
manually. For more information, please see the `README.md` in the scripts directory.
|
||||
|
||||
## Using the update-sequences.sql script
|
||||
|
Reference in New Issue
Block a user