-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2982 from SCADA-LTS/feature/#1580_Improvement_des…
…cribe_information_about_scada_on_top2 #1580 Improvement describe information about scada on top
- Loading branch information
Showing
22 changed files
with
209 additions
and
22 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
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
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
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
45 changes: 45 additions & 0 deletions
45
src/org/scada_lts/dao/migration/mysql/V2_8_0_2_AddTopDescriptionColumnsToSystemSettings.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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.scada_lts.dao.migration.mysql; | ||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.flywaydb.core.api.migration.BaseJavaMigration; | ||
import org.flywaydb.core.api.migration.Context; | ||
import org.scada_lts.dao.DAO; | ||
import org.springframework.jdbc.core.JdbcTemplate; | ||
|
||
public class V2_8_0_2_AddTopDescriptionColumnsToSystemSettings extends BaseJavaMigration { | ||
|
||
private static final Log LOG = LogFactory.getLog(V2_8_0_2_AddTopDescriptionColumnsToSystemSettings.class); | ||
|
||
@Override | ||
public void migrate(Context context) throws Exception { | ||
final JdbcTemplate jdbcTmp = DAO.getInstance().getJdbcTemp(); | ||
|
||
try { | ||
addTopDescriptionColumns(jdbcTmp); | ||
} catch (Exception ex) { | ||
LOG.error(ex.getMessage(), ex); | ||
throw ex; | ||
} | ||
} | ||
|
||
private void addTopDescriptionColumns(JdbcTemplate jdbcTmp) { | ||
boolean existsTopDescriptionColumn = jdbcTmp.queryForObject( | ||
"SELECT (SELECT `TABLE_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`= DATABASE() AND `TABLE_NAME`='systemSettings' AND `COLUMN_NAME`='topDescription') IS NOT NULL;", | ||
boolean.class | ||
); | ||
|
||
boolean existsTopDescriptionPrefixColumn = jdbcTmp.queryForObject( | ||
"SELECT (SELECT `TABLE_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`= DATABASE() AND `TABLE_NAME`='systemSettings' AND `COLUMN_NAME`='topDescriptionPrefix') IS NOT NULL;", | ||
boolean.class | ||
); | ||
|
||
if (!existsTopDescriptionColumn) { | ||
jdbcTmp.update("ALTER TABLE systemSettings ADD COLUMN topDescription VARCHAR(255) DEFAULT '';"); | ||
} | ||
|
||
if (!existsTopDescriptionPrefixColumn) { | ||
jdbcTmp.update("ALTER TABLE systemSettings ADD COLUMN topDescriptionPrefix VARCHAR(255) DEFAULT '';"); | ||
} | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.