From eb1095f501e223ceaa195f7f5f8f5ef10dcaacb0 Mon Sep 17 00:00:00 2001 From: Patrykb0802 Date: Mon, 23 Sep 2024 15:25:49 +0200 Subject: [PATCH] #1580 Improvement describe information about scada on top --- ...TopDescriptionColumnsToSystemSettings.java | 45 ------------------- 1 file changed, 45 deletions(-) delete mode 100644 src/org/scada_lts/dao/migration/mysql/V2_8_0_2_AddTopDescriptionColumnsToSystemSettings.java diff --git a/src/org/scada_lts/dao/migration/mysql/V2_8_0_2_AddTopDescriptionColumnsToSystemSettings.java b/src/org/scada_lts/dao/migration/mysql/V2_8_0_2_AddTopDescriptionColumnsToSystemSettings.java deleted file mode 100644 index c29157695..000000000 --- a/src/org/scada_lts/dao/migration/mysql/V2_8_0_2_AddTopDescriptionColumnsToSystemSettings.java +++ /dev/null @@ -1,45 +0,0 @@ -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 '';"); - } - } -}