/
Task230426AlterVarcharLengthOfLockedByCol.java
38 lines (32 loc) · 1.37 KB
/
Task230426AlterVarcharLengthOfLockedByCol.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.dotmarketing.startup.runonce;
import com.dotmarketing.common.db.DotConnect;
import com.dotmarketing.exception.DotDataException;
import com.dotmarketing.exception.DotRuntimeException;
import com.dotmarketing.startup.StartupTask;
import java.sql.SQLException;
/**
* This class alter the locked_by column in four different tables.
* The locked_by column in some coses has a length of 36. With this class
* we are increasing that length to 100.
*/
public class Task230426AlterVarcharLengthOfLockedByCol implements StartupTask {
private void alterTables() throws SQLException {
final DotConnect dc = new DotConnect();
dc.executeStatement("alter table contentlet_version_info alter column locked_by type varchar (100)");
dc.executeStatement("alter table container_version_info alter column locked_by type varchar (100)");
dc.executeStatement("alter table template_version_info alter column locked_by type varchar (100)");
dc.executeStatement("alter table link_version_info alter column locked_by type varchar (100)");
}
@Override
public boolean forceRun() {
return true;
}
@Override
public void executeUpgrade() throws DotDataException, DotRuntimeException {
try {
alterTables();
} catch (SQLException e) {
throw new DotDataException(e.getMessage(),e);
}
}
}