Rollback 118791 - ACE-1636

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@118833 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2015-11-30 11:07:44 +00:00
parent b87ce71ebf
commit 030405dcb8
9 changed files with 4 additions and 481 deletions

View File

@@ -250,11 +250,6 @@
<nullable>true</nullable> <nullable>true</nullable>
<autoincrement>false</autoincrement> <autoincrement>false</autoincrement>
</column> </column>
<column name="TIME_" order="11">
<type>datetime</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
</columns> </columns>
<primarykey name="PRIMARY"> <primarykey name="PRIMARY">
<columnnames> <columnnames>
@@ -695,13 +690,7 @@
</columnnames> </columnnames>
</primarykey> </primarykey>
<foreignkeys/> <foreignkeys/>
<indexes> <indexes/>
<index name="ACT_IDX_HI_TASK_INST_PROCINST" unique="false">
<columnnames>
<columnname>PROC_INST_ID_</columnname>
</columnnames>
</index>
</indexes>
</table> </table>
<table name="act_hi_varinst"> <table name="act_hi_varinst">
<columns> <columns>
@@ -1179,11 +1168,6 @@
<nullable>true</nullable> <nullable>true</nullable>
<autoincrement>false</autoincrement> <autoincrement>false</autoincrement>
</column> </column>
<column name="HAS_GRAPHICAL_NOTATION_" order="14">
<type>tinyint</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
</columns> </columns>
<primarykey name="PRIMARY"> <primarykey name="PRIMARY">
<columnnames> <columnnames>
@@ -1366,11 +1350,6 @@
<nullable>true</nullable> <nullable>true</nullable>
<autoincrement>false</autoincrement> <autoincrement>false</autoincrement>
</column> </column>
<column name="LOCK_TIME_" order="17">
<type>timestamp</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
</columns> </columns>
<primarykey name="PRIMARY"> <primarykey name="PRIMARY">
<columnnames> <columnnames>
@@ -1950,65 +1929,5 @@
<foreignkeys/> <foreignkeys/>
<indexes/> <indexes/>
</table> </table>
<table name="act_procdef_info">
<columns>
<column name="ID_" order="1">
<type>varchar(64)</type>
<nullable>false</nullable>
<autoincrement>false</autoincrement>
</column>
<column name="PROC_DEF_ID_" order="2">
<type>varchar(64)</type>
<nullable>false</nullable>
<autoincrement>false</autoincrement>
</column>
<column name="REV_" order="3">
<type>int</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
<column name="INFO_JSON_ID_" order="4">
<type>varchar(64)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
</columns>
<primarykey name="PRIMARY">
<columnnames>
<columnname order="1">ID_</columnname>
</columnnames>
</primarykey>
<foreignkeys>
<foreignkey name="ACT_FK_INFO_JSON_BA">
<localcolumn>INFO_JSON_ID_</localcolumn>
<targettable>ACT_GE_BYTEARRAY</targettable>
<targetcolumn>ID_</targetcolumn>
</foreignkey>
<foreignkey name="ACT_FK_INFO_PROCDEF">
<localcolumn>PROC_DEF_ID_</localcolumn>
<targettable>ACT_RE_PROCDEF</targettable>
<targetcolumn>ID_</targetcolumn>
</foreignkey>
</foreignkeys>
<indexes>
<index name="ACT_UNIQ_INFO_PROCDEF" unique="true">
<columnnames>
<columnname>PROC_DEF_ID_</columnname>
</columnnames>
</index>
<index name="ACT_IDX_INFO_PROCDEF" unique="false">
<columnnames>
<columnname>PROC_DEF_ID_</columnname>
</columnnames>
</index>
<index name="ACT_FK_INFO_JSON_BA" unique="false">
<columnnames>
<columnname>INFO_JSON_ID_</columnname>
</columnnames>
</index>
</indexes>
</table>
</objects> </objects>
</schema> </schema>

View File

@@ -322,11 +322,6 @@
<nullable>true</nullable> <nullable>true</nullable>
<autoincrement>false</autoincrement> <autoincrement>false</autoincrement>
</column> </column>
<column name="time_" order="11">
<type>timestamp</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
</columns> </columns>
<primarykey name="act_hi_attachment_pkey"> <primarykey name="act_hi_attachment_pkey">
<columnnames> <columnnames>
@@ -767,13 +762,7 @@
</columnnames> </columnnames>
</primarykey> </primarykey>
<foreignkeys/> <foreignkeys/>
<indexes> <indexes/>
<index name="act_idx_hi_task_inst_procinst" unique="false">
<columnnames>
<columnname>proc_inst_id_</columnname>
</columnnames>
</index>
</indexes>
</table> </table>
<table name="act_hi_varinst"> <table name="act_hi_varinst">
<columns> <columns>
@@ -1256,11 +1245,6 @@
<nullable>true</nullable> <nullable>true</nullable>
<autoincrement>false</autoincrement> <autoincrement>false</autoincrement>
</column> </column>
<column name="has_graphical_notation_" order="14">
<type>bool</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
</columns> </columns>
<primarykey name="act_re_procdef_pkey"> <primarykey name="act_re_procdef_pkey">
<columnnames> <columnnames>
@@ -1443,11 +1427,6 @@
<nullable>true</nullable> <nullable>true</nullable>
<autoincrement>false</autoincrement> <autoincrement>false</autoincrement>
</column> </column>
<column name="lock_time_" order="17">
<type>timestamp</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
</columns> </columns>
<primarykey name="act_ru_execution_pkey"> <primarykey name="act_ru_execution_pkey">
<columnnames> <columnnames>
@@ -1956,63 +1935,5 @@
</index> </index>
</indexes> </indexes>
</table> </table>
<table name="act_procdef_info">
<columns>
<column name="ID_" order="1">
<type>varchar(64)</type>
<nullable>false</nullable>
<autoincrement>false</autoincrement>
</column>
<column name="PROC_DEF_ID_" order="2">
<type>varchar(64)</type>
<nullable>false</nullable>
<autoincrement>false</autoincrement>
</column>
<column name="REV_" order="3">
<type>int4</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
<column name="INFO_JSON_ID_" order="4">
<type>varchar(64)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
</columns>
<primarykey name="act_procdef_info_pkey">
<columnnames>
<columnname order="1">id_</columnname>
</columnnames>
</primarykey>
<foreignkeys>
<foreignkey name="act_fk_info_json_ba">
<localcolumn>info_json_id_</localcolumn>
<targettable>act_ge_bytearray</targettable>
<targetcolumn>id_</targetcolumn>
</foreignkey>
<foreignkey name="act_fk_info_procdef">
<localcolumn>proc_def_id_</localcolumn>
<targettable>act_re_procdef</targettable>
<targetcolumn>id_</targetcolumn>
</foreignkey>
</foreignkeys>
<indexes>
<index name="act_uniq_info_procdef" unique="true">
<columnnames>
<columnname>proc_def_id_</columnname>
</columnnames>
</index>
<index name="act_idx_procdef_info_proc" unique="false">
<columnnames>
<columnname>proc_def_id_</columnname>
</columnnames>
</index>
<index name="act_idx_procdef_info_json" unique="false">
<columnnames>
<columnname>info_json_id_</columnname>
</columnnames>
</index>
</indexes>
</table>
</objects> </objects>
</schema> </schema>

View File

@@ -87,7 +87,6 @@
<ref bean="patch.db-V5.0-upgrade-to-activiti-5.16.2" /> <ref bean="patch.db-V5.0-upgrade-to-activiti-5.16.2" />
<ref bean="patch.db-V5.0-upgrade-to-activiti-5.16.4" /> <ref bean="patch.db-V5.0-upgrade-to-activiti-5.16.4" />
<ref bean="patch.db-V5.0-remove-columns-after-upgrade-to-activiti-5.16.2" /> <ref bean="patch.db-V5.0-remove-columns-after-upgrade-to-activiti-5.16.2" />
<ref bean="patch.db-V5.1-upgrade-to-activiti-5.19.0" />
</list> </list>
</property> </property>
</bean> </bean>

View File

@@ -1,66 +0,0 @@
--
-- Title: Update activiti from 5.16.4 to 5.19.0
-- Database: Generic
-- Since: V5.1 Schema 9012
-- Author: Mark Rogers
--
-- Please contact support@alfresco.com if you need assistance with the upgrade.
--
update ACT_GE_PROPERTY set VALUE_ = '5.17.0.0' where NAME_ = 'schema.version';
alter table ACT_RE_PROCDEF add HAS_GRAPHICAL_NOTATION_ bit;
update ACT_GE_PROPERTY set VALUE_ = '5.17.0.1' where NAME_ = 'schema.version';
alter table ACT_RU_EXECUTION add LOCK_TIME_ timestamp;
update ACT_GE_PROPERTY set VALUE_ = '5.17.0.2' where NAME_ = 'schema.version';
alter table ACT_HI_ATTACHMENT add TIME_ timestamp;
update ACT_GE_PROPERTY set VALUE_ = '5.18.0.0' where NAME_ = 'schema.version';
create index ACT_IDX_HI_TASK_INST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_);
update ACT_GE_PROPERTY set VALUE_ = '5.18.0.1' where NAME_ = 'schema.version';
create table ACT_PROCDEF_INFO (
ID_ varchar(64) not null,
PROC_DEF_ID_ varchar(64) not null,
REV_ integer,
INFO_JSON_ID_ varchar(64),
primary key (ID_)
);
create index ACT_IDX_INFO_PROCDEF on ACT_PROCDEF_INFO(PROC_DEF_ID_);
alter table ACT_PROCDEF_INFO
add constraint ACT_FK_INFO_JSON_BA
foreign key (INFO_JSON_ID_)
references ACT_GE_BYTEARRAY (ID_);
alter table ACT_PROCDEF_INFO
add constraint ACT_FK_INFO_PROCDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);
alter table ACT_PROCDEF_INFO
add constraint ACT_UNIQ_INFO_PROCDEF
unique (PROC_DEF_ID_);
update ACT_GE_PROPERTY set VALUE_ = '5.18.0.1' where NAME_ = 'schema.version';
update ACT_GE_PROPERTY set VALUE_ = '5.19.0.0' where NAME_ = 'schema.version';
--
-- Record script finish
--
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V5.1-upgrade-to-activiti-5.19.0';
INSERT INTO alf_applied_patch
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
VALUES
(
'patch.db-V5.1-upgrade-to-activiti-5.19.0', 'Manually executed script upgrade patch.db-V5.1-upgrade-to-activiti-5.19.0',
0, 9011, -1, 9012, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
);

View File

@@ -1,64 +0,0 @@
--
-- Title: Update activiti to 5.19.0
-- Database: MySQL InnoDB
-- Since: V5.1 Schema 9012
-- Author: Mark Rogers
--
-- Please contact support@alfresco.com if you need assistance with the upgrade.
--
update ACT_GE_PROPERTY set VALUE_ = '5.17.0.0' where NAME_ = 'schema.version';
alter table ACT_RE_PROCDEF add HAS_GRAPHICAL_NOTATION_ TINYINT;
update ACT_GE_PROPERTY set VALUE_ = '5.17.0.1' where NAME_ = 'schema.version';
alter table ACT_RU_EXECUTION add LOCK_TIME_ timestamp NULL;
update ACT_GE_PROPERTY set VALUE_ = '5.17.0.2' where NAME_ = 'schema.version';
alter table ACT_HI_ATTACHMENT add TIME_ datetime;
update ACT_GE_PROPERTY set VALUE_ = '5.18.0.0' where NAME_ = 'schema.version';
create index ACT_IDX_HI_TASK_INST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_);
update ACT_GE_PROPERTY set VALUE_ = '5.18.0.1' where NAME_ = 'schema.version';
create table ACT_PROCDEF_INFO (
ID_ varchar(64) not null,
PROC_DEF_ID_ varchar(64) not null,
REV_ integer,
INFO_JSON_ID_ varchar(64),
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
create index ACT_IDX_INFO_PROCDEF on ACT_PROCDEF_INFO(PROC_DEF_ID_);
alter table ACT_PROCDEF_INFO
add constraint ACT_FK_INFO_JSON_BA
foreign key (INFO_JSON_ID_)
references ACT_GE_BYTEARRAY (ID_);
alter table ACT_PROCDEF_INFO
add constraint ACT_FK_INFO_PROCDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);
alter table ACT_PROCDEF_INFO
add constraint ACT_UNIQ_INFO_PROCDEF
unique (PROC_DEF_ID_);
update ACT_GE_PROPERTY set VALUE_ = '5.19.0.0' where NAME_ = 'schema.version';
--
-- Record script finish
--
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V5.1-upgrade-to-activiti-5.19.0';
INSERT INTO alf_applied_patch
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
VALUES
(
'patch.db-V5.1-upgrade-to-activiti-5.19.0', 'Manually executed script upgrade patch.db-V5.1-upgrade-to-activiti-5.19.0',
0, 9011, -1, 9012, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
);

View File

@@ -1,75 +0,0 @@
--
-- Title: Upgraded Activiti tables from 5.14.4 to 5.19.0 version
-- Database: PostgreSQL
-- Since: V5.0 Schema 9012
-- Author: Mark Rogers
--
-- Please contact support@alfresco.com if you need assistance with the upgrade.
--
-- Upgraded Activiti tables from 5.14.4 to 5.19.9 version, sql statements were copied from original activiti jar file.
update ACT_GE_PROPERTY set VALUE_ = '5.17.0.0' where NAME_ = 'schema.version';
alter table ACT_RE_PROCDEF add HAS_GRAPHICAL_NOTATION_ boolean;
update ACT_GE_PROPERTY set VALUE_ = '5.17.0.1' where NAME_ = 'schema.version';
alter table ACT_RU_EXECUTION add LOCK_TIME_ timestamp;
update ACT_GE_PROPERTY set VALUE_ = '5.17.0.2' where NAME_ = 'schema.version';
alter table ACT_HI_ATTACHMENT add TIME_ timestamp;
update ACT_GE_PROPERTY set VALUE_ = '5.18.0.0' where NAME_ = 'schema.version';
create index ACT_IDX_HI_TASK_INST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_);
update ACT_GE_PROPERTY set VALUE_ = '5.18.0.1' where NAME_ = 'schema.version';
create table ACT_PROCDEF_INFO (
ID_ varchar(64) not null,
PROC_DEF_ID_ varchar(64) not null,
REV_ integer,
INFO_JSON_ID_ varchar(64),
primary key (ID_)
);
create index ACT_IDX_PROCDEF_INFO_JSON on ACT_PROCDEF_INFO(INFO_JSON_ID_);
alter table ACT_PROCDEF_INFO
add constraint ACT_FK_INFO_JSON_BA
foreign key (INFO_JSON_ID_)
references ACT_GE_BYTEARRAY (ID_);
create index ACT_IDX_PROCDEF_INFO_PROC on ACT_PROCDEF_INFO(PROC_DEF_ID_);
alter table ACT_PROCDEF_INFO
add constraint ACT_FK_INFO_PROCDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);
alter table ACT_PROCDEF_INFO
add constraint ACT_UNIQ_INFO_PROCDEF
unique (PROC_DEF_ID_);
update ACT_GE_PROPERTY set VALUE_ = '5.19.0.0' where NAME_ = 'schema.version';
--
-- Record script finish
--
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V5.1-upgrade-to-activiti-5.19.0';
INSERT INTO alf_applied_patch
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
VALUES
(
'patch.db-V5.1-upgrade-to-activiti-5.19.0', 'Manually executed script upgrade patch.db-V5.1-upgrade-to-activiti-5.19.0',
0, 9011, -1, 9012, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
);

View File

@@ -1278,16 +1278,4 @@
</props> </props>
</property> </property>
</bean> </bean>
<bean id="patch.db-V5.1-upgrade-to-activiti-5.19.0" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
<property name="id" value="patch.db-V5.1-upgrade-to-activiti-5.19.0" />
<property name="description" value="patch.db-V5.1-upgrade-to-activiti-5.19.0" />
<property name="fixesFromSchema" value="0" />
<property name="fixesToSchema" value="9012" />
<property name="targetSchema" value="9013" />
<property name="scriptUrl">
<value>classpath:alfresco/dbscripts/upgrade/5.1/${db.script.dialect}/activiti-upgrade-5-19-0.sql</value>
</property>
</bean>
</beans> </beans>

View File

@@ -107,16 +107,12 @@ public class Index extends AbstractDbObject
if (!super.equals(obj)) return false; if (!super.equals(obj)) return false;
if (getClass() != obj.getClass()) return false; if (getClass() != obj.getClass()) return false;
Index other = (Index) obj; Index other = (Index) obj;
if (this.unique != other.unique)
{
return false;
}
if (this.columnNames == null) if (this.columnNames == null)
{ {
if (other.columnNames != null) return false; if (other.columnNames != null) return false;
} }
else if (!this.columnNames.equals(other.columnNames)) return false; else if (!this.columnNames.equals(other.columnNames)) return false;
if (this.unique != other.unique) return false;
return true; return true;
} }
@@ -140,16 +136,11 @@ public class Index extends AbstractDbObject
} }
else else
{ {
// If one index is unique and the other is not then it is not a match
if (this.unique != other.unique)
{
return false;
}
// The name may be different, but if it has the same parent table (see above) // The name may be different, but if it has the same parent table (see above)
// and indexes the same columns, then it is the same index. // and indexes the same columns, then it is the same index.
return columnNames.equals(other.getColumnNames()); return columnNames.equals(other.getColumnNames());
} }
} }
return false; return false;

View File

@@ -30,20 +30,13 @@ import static org.alfresco.util.schemacomp.SchemaCompTestingUtils.table;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import org.alfresco.util.schemacomp.Difference.Where; import org.alfresco.util.schemacomp.Difference.Where;
import org.alfresco.util.schemacomp.model.DbObject;
import org.alfresco.util.schemacomp.model.Index;
import org.alfresco.util.schemacomp.model.PrimaryKey; import org.alfresco.util.schemacomp.model.PrimaryKey;
import org.alfresco.util.schemacomp.model.Schema; import org.alfresco.util.schemacomp.model.Schema;
import org.alfresco.util.schemacomp.model.Table; import org.alfresco.util.schemacomp.model.Table;
import org.alfresco.util.schemacomp.validator.DbValidator;
import org.alfresco.util.schemacomp.validator.NameValidator;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.MySQL5InnoDBDialect; import org.hibernate.dialect.MySQL5InnoDBDialect;
import org.junit.Before; import org.junit.Before;
@@ -352,87 +345,4 @@ public class SchemaComparatorTest
// There are no logical differences // There are no logical differences
assertEquals(0, results.size()); assertEquals(0, results.size());
} }
/**
* Tests index of primary key validation, problem found when comparing DB2 schemas which has
* system generated indexes for primary keys
*/
@Test
public void systemGeneratedPrimaryKeyAndIndex()
{
reference = new Schema("schema", "alf_", 9012, false);
target = new Schema("schema", "alf_", 9012, false);
NameValidator validator = new NameValidator();
validator.setProperty("pattern","SQL[0-9]+");
final List<DbValidator> validators = new ArrayList<DbValidator>();
validators.add(new NameValidator());
reference.add(new Table(
reference,
"ALF_ACL_CHANGE_SET",
columns(false, "id NUMBER(10)", "nodeRef VARCHAR2(200)", "name VARCHAR2(150)"),
new PrimaryKey(null, "SQL120116153559440", Arrays.asList("id", "nodeRef"), Arrays.asList(1, 2)),
fkeys(),
indexes("SQL120116153559441 [unique] ID_", "fooX ID_")));
// Target schema's database objects
target.add(new Table(
target,
"ALF_ACL_CHANGE_SET",
columns(false, "id NUMBER(10)", "name VARCHAR2(150)", "nodeRef VARCHAR2(200)"),
new PrimaryKey(null, "SQL120116153559442", Arrays.asList("id", "nodeRef"), Arrays.asList(1, 2)),
fkeys(),
indexes("SQL120116153559443 [unique] ID_", "fooX ID_")));
reference.add(new Table(
reference,
"ALF_LOCK_RESOURCE",
columns(false, "id NUMBER(10)", "nodeRef VARCHAR2(200)", "name VARCHAR2(150)"),
new PrimaryKey(null, "SQL120116153554310", Arrays.asList("ID", "int"), Arrays.asList(1, 2)),
fkeys(),
indexes("SQL120116153616440 [unique] ID_")));
target.add(new Table(
reference,
"ALF_LOCK_RESOURCE",
columns(false, "id NUMBER(10)", "nodeRef VARCHAR2(200)", "name VARCHAR2(150)"),
new PrimaryKey(null, "SQL120116153554313", Arrays.asList("ID", "int"), Arrays.asList(1, 2)),
fkeys(),
indexes("SQL120116153616444 [unique] ID_")));
/**
* Now plug in the pattern validator
*/
DbObjectVisitor visitor = new DbObjectVisitor()
{
@Override
public void visit(DbObject dbObject)
{
if(dbObject instanceof Index)
{
dbObject.setValidators(validators);
}
if(dbObject instanceof PrimaryKey)
{
dbObject.setValidators(validators);
}
}
};
reference.accept(visitor);
target.accept(visitor);
comparator = new SchemaComparator(reference, target, dialect);
comparator.validateAndCompare();
// See stdout for diagnostics dump...
dumpDiffs(comparator.getComparisonResults(), false);
dumpValidation(comparator.getComparisonResults());
Results results = comparator.getComparisonResults();
// There are no logical differences
assertEquals(0, results.size());
}
} }