Skip to content

Commit

Permalink
Merge pull request #1237 from Muni10/master
Browse files Browse the repository at this point in the history
Fixed #1120, 3.x->4.0 migration, storage group setting, moved tests
  • Loading branch information
Axel Fontaine committed Mar 21, 2016
2 parents 22dbafa + b48dce7 commit 9c48d11
Show file tree
Hide file tree
Showing 35 changed files with 1,570 additions and 411 deletions.
2 changes: 1 addition & 1 deletion flyway-core/pom.xml
Expand Up @@ -380,7 +380,7 @@
<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc</artifactId>
<version>8.1</version>
<version>3.4.65</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Expand Up @@ -14,21 +14,17 @@
-- limitations under the License.
--

set current sqlid = '${schema}';
SET CURRENT SQLID = '${schema}';

CREATE TABLESPACE SDBVERS
CREATE TABLESPACE SFLYWAY
IN "${schema}"
USING STOGROUP SENSITIV PRIQTY -1 SECQTY -1 ERASE NO FREEPAGE 0 PCTFREE 10 DEFINE YES TRACKMOD YES
SEGSIZE 64
BUFFERPOOL BP3
LOCKSIZE PAGE
LOCKMAX SYSTEM
CLOSE YES
COMPRESS YES
CCSID UNICODE
;


SEGSIZE 4
BUFFERPOOL BP0
LOCKSIZE PAGE
LOCKMAX SYSTEM
CLOSE YES
COMPRESS YES
;

CREATE TABLE "${schema}"."${table}" (
"installed_rank" INT NOT NULL,
Expand All @@ -43,12 +39,10 @@ CREATE TABLE "${schema}"."${table}" (
"success" SMALLINT NOT NULL,
CONSTRAINT "${table}_s" CHECK ("success" in(0,1))
)
IN "${schema}".SDBVERS
CCSID UNICODE
;
IN "${schema}".SFLYWAY;

CREATE UNIQUE INDEX "${schema}"."${table}_IR_IDX" ON "${schema}"."${table}" ("installed_rank");
ALTER TABLE "${schema}"."${table}" ADD CONSTRAINT "${table}_PK" PRIMARY KEY ("installed_rank");

CREATE INDEX "${schema}"."${table}_S_IDX" ON "${schema}"."${table}" ("success");


ALTER TABLE "${schema}"."${table}" ADD CONSTRAINT "${table}_S" CHECK ("success" in(0,1));
Expand Up @@ -14,11 +14,62 @@
-- limitations under the License.
--

DROP INDEX "${schema}"."${table}_vr_idx";
DROP INDEX "${schema}"."${table}_ir_idx";
ALTER TABLE "${schema}"."${table}" DROP COLUMN "version_rank";
ALTER TABLE "${schema}"."${table}" DROP CONSTRAINT "${table}_pk";
ALTER TABLE "${schema}"."${table}" ALTER COLUMN "version" DROP NOT NULL;
call ADMIN_CMD('REORG TABLE "${schema}"."${table}"');
ALTER TABLE "${schema}"."${table}" ADD CONSTRAINT "${table}_pk" PRIMARY KEY ("installed_rank");
SET CURRENT SQLID = '${schema}';

CREATE TABLESPACE SFLYWAY
IN "${schema}"
SEGSIZE 4
BUFFERPOOL BP0
LOCKSIZE PAGE
LOCKMAX SYSTEM
CLOSE YES
COMPRESS YES
;


CREATE TABLE "${schema}"."TMP_${table}" (
"installed_rank" INT NOT NULL,
"version" VARCHAR(50),
"description" VARCHAR(200) NOT NULL,
"type" VARCHAR(20) NOT NULL,
"script" VARCHAR(1000) NOT NULL,
"checksum" INT,
"installed_by" VARCHAR(100) NOT NULL,
"installed_on" TIMESTAMP NOT NULL WITH DEFAULT,
"execution_time" INT NOT NULL,
"success" SMALLINT NOT NULL,
CONSTRAINT "${table}_S" CHECK ("success" in(0,1))
)
IN "${schema}".SFLYWAY;


INSERT INTO "${schema}"."TMP_${table}"(
SELECT
"installed_rank",
"version",
"description",
"type",
"script",
"checksum",
"installed_by",
"installed_on",
"execution_time",
"success"
FROM "${schema}"."${table}");

--drop all the old things
DROP TABLE "${schema}"."${table}";
DROP TABLESPACE "${schema}".SDBVERS;

RENAME TABLE "${schema}"."TMP_${table}" TO "${table}";

UPDATE "${schema}"."${table}" SET "type"='BASELINE' WHERE "type"='INIT';

CREATE UNIQUE INDEX "${schema}"."${table}_IR_IDX" ON "${schema}"."${table}" ("installed_rank");
ALTER TABLE "${schema}"."${table}" ADD CONSTRAINT "${table}_PK" PRIMARY KEY ("installed_rank");

CREATE INDEX "${schema}"."${table}_S_IDX" ON "${schema}"."${table}" ("success");




Expand Up @@ -15,23 +15,24 @@
*/
package org.flywaydb.core.internal.dbsupport.db2zos;

import java.util.Properties;

import javax.sql.DataSource;

import org.flywaydb.core.DbCategory;
import org.flywaydb.core.migration.ConcurrentMigrationTestCase;
import org.flywaydb.core.internal.util.jdbc.DriverDataSource;
import org.flywaydb.core.migration.ConcurrentMigrationTestCase;
import org.junit.experimental.categories.Category;

import javax.sql.DataSource;
import java.util.Properties;

@Category(DbCategory.DB2zOS.class)
public class DB2zOSConcurrentMigrationMediumTest extends ConcurrentMigrationTestCase {

@Override
protected DataSource createDataSource(Properties customProperties) throws Exception {
String user = customProperties.getProperty("db2.user", "TESTADMS");
String password = customProperties.getProperty("db2.password", "passord");
String url = customProperties.getProperty("db2.url", "jdbc:db2://host:port/schemaname");
@Override
protected DataSource createDataSource(Properties customProperties) throws Exception {
String user = customProperties.getProperty("db2.user", "AURINTS");
String password = customProperties.getProperty("db2.password", "password");
String url = customProperties.getProperty("db2.url", "jdbc:db2://host:port/schemaname");

return new DriverDataSource(Thread.currentThread().getContextClassLoader(),null, url, user, password);
}
return new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, url, user, password);
}
}

0 comments on commit 9c48d11

Please sign in to comment.