Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed Configuration CTL migration, refactoring and added default reco…
…rd generation
- Loading branch information
Showing
8 changed files
with
98 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...a-migration-0.9.0-0.10.0/src/main/java/org/kaaproject/data_migration/utils/Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
package org.kaaproject.data_migration.utils; | |||
|
|||
|
|||
final public class Constants { | |||
public static final String USER_NAME = "sqladmin"; | |||
public static final String PASSWORD = "admin"; | |||
public static final String DB_NAME = "kaa"; | |||
public static final String HOST = "10.2.1.130"; | |||
public static final Integer PORT = 8080; | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
.../data-migration-0.9.0-0.10.0/src/main/java/org/kaaproject/data_migration/utils/Utils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,18 @@ | |||
package org.kaaproject.data_migration.utils; | |||
|
|||
|
|||
import org.apache.commons.dbutils.QueryRunner; | |||
import org.apache.commons.io.IOUtils; | |||
|
|||
import java.io.IOException; | |||
import java.sql.Connection; | |||
import java.sql.SQLException; | |||
|
|||
public class Utils { | |||
|
|||
public static void runFile(QueryRunner runner, Connection connection, String fileName) throws IOException, SQLException { | |||
String query = IOUtils.toString(Utils.class.getClassLoader().getResourceAsStream(fileName)); | |||
runner.update(connection, query); | |||
} | |||
|
|||
} |
5 changes: 0 additions & 5 deletions
5
server/upgrade/data-migration-0.9.0-0.10.0/src/main/resources/doc/constraint_update.sql
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
...r/upgrade/data-migration-0.9.0-0.10.0/src/main/resources/doc/constraint_update_before.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,14 @@ | |||
SET @const_name = (SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = 'kaa' AND TABLE_NAME = 'configuration_schems' and referenced_table_name='schems'); | |||
SET @sql = CONCAT('ALTER TABLE configuration_schems DROP FOREIGN KEY ', @const_name); | |||
PREPARE s from @sql; | |||
EXECUTE s; | |||
DEALLOCATE PREPARE s; | |||
|
|||
SET @const_name = (SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = 'kaa' AND TABLE_NAME = 'configuration' and referenced_table_name='configuration_schems'); | |||
SET @sql = CONCAT('ALTER TABLE configuration DROP FOREIGN KEY ', @const_name); | |||
PREPARE s from @sql; | |||
EXECUTE s; | |||
DEALLOCATE PREPARE s; | |||
|
|||
ALTER TABLE configuration add constraint `FK_configuration_schems_id` | |||
FOREIGN KEY (`configuration_schems_id`) REFERENCES `configuration_schems` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters