Reputation: 67
I am trying to change the length of Description attribute in AbstractRuleEngineRule (visible in promotion rule widget in backoffice)
Since, the column is already persisted in database and we cannot initialize the system, i found a workaround for this by altering the table during update system.
@SystemSetup(extension = "ezibuypromotionengine")
public class CoreSystemSetup extends AbstractSystemSetup{
private static final Logger LOG = Logger.getLogger(CoreSystemSetup.class);
/**
* This method will be called during the system update.
*/
@SystemSetup(type = Type.PROJECT, process = Process.UPDATE)
public void updateColumnsSize(final SystemSetupContext context)
{
Connection conn = null;
PreparedStatement pstmt = null;
try
{
conn = Registry.getCurrentTenant().getDataSource().getConnection();
pstmt = conn.prepareStatement("alter table AbstractRuleEngineRule alter column description varchar(500)");
pstmt.execute();
}
catch (final SQLException e)
{
LOG.error("Unable to alter database column - " + e);
}
finally
{
Utilities.tryToCloseJDBC(conn, pstmt, null);
}
}
}
But i am getting an error
ERROR [hybrisHTTP26] [CoreSystemSetup] Unable to alter database column - java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: PUBLIC.ABSTRACTRULEENGINERULE
Upvotes: 1
Views: 902
Reputation: 996
AbstractRuleEngineRule is the type, not the tablename. You need to look at the deployment to see what the tablename is. E.g. <deployment table="EngineRules" ....
Upvotes: 2