Skip to content

Commit

Permalink
SCT-27 Added Oracle, Mysql, Postgres init scripts
Browse files Browse the repository at this point in the history
* Added Mysql to DatabaseTypes

Resolves #27
  • Loading branch information
cppwfs authored and trisberg committed Dec 14, 2015
1 parent 56f6592 commit ec096b4
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public enum DatabaseType {

HSQL("HSQL Database Engine"),
ORACLE("Oracle"),
MYSQL("MySQL"),
POSTGRES("PostgreSQL");

private static final Map<String, DatabaseType> dbNameMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ public static void initializeDatabase(DataSource dataSource, ResourceLoader reso
if ("oracle".equals(platform)) {
platform = "oracle10g";
}
if ("mysql".equals(platform)) {
platform = "mysql";
}
ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
String schemaLocation = schema;
schemaLocation = schemaLocation.replace("@@platform@@", platform);
populator.addScript(resourceLoader.getResource(schemaLocation));
populator.setContinueOnError(false);
populator.setContinueOnError(true);
logger.debug(String.format("Initializing task schema for %s database",
platform));
DatabasePopulatorUtils.execute(populator, dataSource);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

CREATE TABLE TASK_EXECUTION (
TASK_EXECUTION_ID VARCHAR(100) NOT NULL PRIMARY KEY ,
START_TIME DATETIME DEFAULT NULL ,
END_TIME DATETIME DEFAULT NULL ,
TASK_NAME VARCHAR(100) ,
EXIT_CODE INTEGER ,
EXIT_MESSAGE VARCHAR(2500) ,
LAST_UPDATED TIMESTAMP ,
STATUS_CODE VARCHAR(10)
);

CREATE TABLE TASK_EXECUTION_PARAMS (
TASK_EXECUTION_ID VARCHAR(100) NOT NULL ,
TASK_PARAM VARCHAR(250) ,
constraint TASK_EXEC_PARAMS_FK foreign key (TASK_EXECUTION_ID)
references TASK_EXECUTION(TASK_EXECUTION_ID)
) ;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

CREATE TABLE TASK_EXECUTION (
TASK_EXECUTION_ID VARCHAR2(100) NOT NULL PRIMARY KEY ,
START_TIME TIMESTAMP DEFAULT NULL ,
END_TIME TIMESTAMP DEFAULT NULL ,
TASK_NAME VARCHAR2(100) ,
EXIT_CODE INTEGER ,
EXIT_MESSAGE VARCHAR2(2500) ,
LAST_UPDATED TIMESTAMP ,
STATUS_CODE VARCHAR2(10)
);

CREATE TABLE TASK_EXECUTION_PARAMS (
TASK_EXECUTION_ID VARCHAR2(100) NOT NULL ,
TASK_PARAM VARCHAR2(250) ,
constraint TASK_EXEC_PARAMS_FK foreign key (TASK_EXECUTION_ID)
references TASK_EXECUTION(TASK_EXECUTION_ID)
) ;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

CREATE TABLE TASK_EXECUTION (
TASK_EXECUTION_ID VARCHAR(100) NOT NULL PRIMARY KEY ,
START_TIME TIMESTAMP DEFAULT NULL ,
END_TIME TIMESTAMP DEFAULT NULL ,
TASK_NAME VARCHAR(100) ,
EXIT_CODE INTEGER ,
EXIT_MESSAGE VARCHAR(2500) ,
LAST_UPDATED TIMESTAMP ,
STATUS_CODE VARCHAR(10)
);

CREATE TABLE TASK_EXECUTION_PARAMS (
TASK_EXECUTION_ID VARCHAR(100) NOT NULL ,
TASK_PARAM VARCHAR(250) ,
constraint TASK_EXEC_PARAMS_FK foreign key (TASK_EXECUTION_ID)
references TASK_EXECUTION(TASK_EXECUTION_ID)
) ;

0 comments on commit ec096b4

Please sign in to comment.