let sqlDataSourceManager = Ametys.serviceManager.lookup(org.ametys.core.datasource.SQLDataSourceManager.ROLE);
let dss = sqlDataSourceManager.getSQLDataSources();
for (let index of dss.keySet())
{
let exists;
let connection = dss.get(index).getConnection();
let dbType = org.ametys.core.datasource.ConnectionHelper.getDatabaseType(connection);
org.ametys.core.datasource.ConnectionHelper.cleanup(connection);
console.log(dbType + " - " + index)
switch (dbType)
{
case "postgre":
case "oracle":
case "mysql":
try {
SQL.update("ALTER TABLE Ametys_Versions MODIFY component_identifier varchar(250) NOT NULL", index);
} catch (e) { print(e); }
break;
case "derby":
try {
SQL.update("ALTER TABLE Ametys_Versions ALTER COLUMN component_identifier SET DATA TYPE varchar(250)", index);
} catch (e) { print(e); }
break;
case "hsqldb":
try {
SQL.update("ALTER TABLE Ametys_Versions ALTER COLUMN component_identifier varchar(250)", index);
} catch (e) { print(e); }
break;
}
}
migration can be linked to RUNTIME-3570