eliminta funzione duplicata
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -177,16 +177,8 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
return val != null && val == 1;
|
||||
}
|
||||
|
||||
protected boolean existColumn(String tableName, String columnName) throws SQLException, IOException {
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(advancedDataSource.getConnection(),
|
||||
Query.format("SELECT CAST(COUNT(*) AS BIT)\n" +
|
||||
"FROM sys.syscolumns\n" +
|
||||
"WHERE name = %s\n" +
|
||||
" AND OBJECT_NAME(id) = %s", columnName, tableName));
|
||||
}
|
||||
|
||||
protected void renameColumn(String tableName, String oldColumnname, String newColumnName) throws SQLException, IOException {
|
||||
if (existColumn(tableName, oldColumnname)) {
|
||||
if (existsColumn(tableName, oldColumnname)) {
|
||||
String sql =
|
||||
"exec sp_rename 'dbo." + tableName + "." + oldColumnname + "', " + newColumnName + ", 'COLUMN'";
|
||||
executeStatement(sql);
|
||||
|
||||
@@ -14,7 +14,7 @@ public class Migration_20241202145553 extends BaseMigration implements Migration
|
||||
if (isCustomerDb(IntegryCustomerDB.Siciliani_DMS))
|
||||
return;
|
||||
|
||||
if (!existColumn("mtb_lisa_costo_data", "part_iva" ))
|
||||
if (!existsColumn("mtb_lisa_costo_data", "part_iva" ))
|
||||
executeStatement("ALTER TABLE mtb_lisa_costo_data ADD part_iva varchar(20)");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ public class Migration_20250224114817 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (existsTable("apuliac_agg_prz_csv") && !existColumn("apuliac_agg_prz_csv", "altro")){
|
||||
if (existsTable("apuliac_agg_prz_csv") && !existsColumn("apuliac_agg_prz_csv", "altro")){
|
||||
executeStatement("alter table apuliac_agg_prz_csv add altro varchar(max)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class Migration_20250225124406 extends BaseMigration implements Migration
|
||||
if (isCustomerDb(IntegryCustomerDB.Siciliani_DMS))
|
||||
return;
|
||||
|
||||
if (!existColumn("mtb_aart", "flag_stampa_docu_vend"))
|
||||
if (!existsColumn("mtb_aart", "flag_stampa_docu_vend"))
|
||||
executeStatement(
|
||||
"alter table mtb_aart add flag_stampa_docu_vend bit not null default 1");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user