Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#17976 Extending index_name column length to 100 as uuid is appended …
…to the index name to avoid duplicity in concurrent environments (#18269) Co-authored-by: Nollymar Longa <>
- Loading branch information
Showing
6 changed files
with
57 additions
and
4 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
dotCMS/src/main/java/com/dotmarketing/startup/runonce/Task05221UpdateIndexNameLength.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.dotmarketing.startup.runonce; | ||
|
||
import com.dotmarketing.startup.AbstractJDBCStartupTask; | ||
import java.util.List; | ||
|
||
public class Task05221UpdateIndexNameLength extends AbstractJDBCStartupTask { | ||
|
||
@Override | ||
public String getMSSQLScript() { | ||
return "DECLARE @SQL VARCHAR(4000)\n" | ||
+ "SET @SQL = 'ALTER TABLE dbo.Indicies DROP CONSTRAINT |ConstraintName| '\n" | ||
+ "\n" | ||
+ "SET @SQL = REPLACE(@SQL, '|ConstraintName|', ( SELECT name\n" | ||
+ " FROM sysobjects\n" | ||
+ " WHERE xtype = 'PK'\n" | ||
+ " AND parent_obj = OBJECT_ID('Indicies')))\n" | ||
+ "\n" | ||
+ "EXEC (@SQL)\n" | ||
+ "alter table indicies alter column index_name nvarchar(100) not null;\n" | ||
+ "alter table Indicies add primary key (index_name);"; | ||
} | ||
|
||
@Override | ||
public String getMySQLScript() { | ||
return "alter table indicies modify index_name varchar(100);"; | ||
} | ||
|
||
@Override | ||
public String getOracleScript() { | ||
return "alter table indicies modify index_name varchar2(100);"; | ||
} | ||
|
||
@Override | ||
public String getPostgresScript() { | ||
return "alter table indicies alter column index_name type varchar(100);"; | ||
} | ||
|
||
@Override | ||
protected List<String> getTablesToDropConstraints() { | ||
return null; | ||
} | ||
|
||
public boolean forceRun() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public String getH2Script() { | ||
return "alter table indicies alter column index_name type varchar(100);"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters