3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.cdm
.database
.update
.v33_34
;
13 import java
.util
.ArrayList
;
14 import java
.util
.List
;
16 import org
.apache
.log4j
.Logger
;
18 import eu
.etaxonomy
.cdm
.database
.update
.ColumnAdder
;
19 import eu
.etaxonomy
.cdm
.database
.update
.ISchemaUpdater
;
20 import eu
.etaxonomy
.cdm
.database
.update
.ISchemaUpdaterStep
;
21 import eu
.etaxonomy
.cdm
.database
.update
.SchemaUpdaterBase
;
22 import eu
.etaxonomy
.cdm
.database
.update
.SimpleSchemaUpdaterStep
;
23 import eu
.etaxonomy
.cdm
.database
.update
.v31_33
.SchemaUpdater_33_331
;
27 * @created Jan 14, 2014
29 public class SchemaUpdater_331_34
extends SchemaUpdaterBase
{
31 @SuppressWarnings("unused")
32 private static final Logger logger
= Logger
.getLogger(SchemaUpdater_331_34
.class);
33 private static final String startSchemaVersion
= "3.3.1.0.201401140000";
34 private static final String endSchemaVersion
= "3.4.0.0.201407010000";
36 // ********************** FACTORY METHOD
37 // *******************************************
39 public static SchemaUpdater_331_34
NewInstance() {
40 return new SchemaUpdater_331_34();
44 * @param startSchemaVersion
45 * @param endSchemaVersion
47 protected SchemaUpdater_331_34() {
48 super(startSchemaVersion
, endSchemaVersion
);
52 protected List
<ISchemaUpdaterStep
> getUpdaterList() {
56 ISchemaUpdaterStep step
;
59 List
<ISchemaUpdaterStep
> stepList
= new ArrayList
<ISchemaUpdaterStep
>();
61 //TODO test and PostGreSQL / SQL Server
63 stepName
= "Update User unique indexes";
64 tableName
= "UserAccount";
65 columnName
= "username";
66 step
= UsernameConstraintUpdater
.NewInstance(stepName
, tableName
, columnName
);
69 //TODO test and PostGreSQL / SQL Server
70 //PermissionGroup unique
71 stepName
= "Update Group unique indexes";
72 tableName
= "PermissionGroup";
74 step
= UsernameConstraintUpdater
.NewInstance(stepName
, tableName
, columnName
);
77 //TODO test and PostGreSQL / SQL Server
78 //GrantedAuthority unique
79 stepName
= "Update User unique indexes";
80 tableName
= "GrantedAuthorityImpl";
81 columnName
= "authority";
82 step
= UsernameConstraintUpdater
.NewInstance(stepName
, tableName
, columnName
);
86 stepName
= "Add label column to derived unit";
87 tableName
= "SpecimenOrObservationBase";
88 columnName
= "originalLabelInfo";
89 step
= ColumnAdder
.NewClobInstance(stepName
, tableName
, columnName
, INCLUDE_AUDIT
);
94 //set default value to true where required
95 stepName
= "Set publish to true if null";
96 String query
= " UPDATE @@TaxonBase@@ " +
97 " SET publish = @TRUE@ " +
98 " WHERE DTYPE IN ('Synonym') AND publish IS NULL ";
99 step
= SimpleSchemaUpdaterStep
.NewAuditedInstance(stepName
, query
, "TaxonBase", 99);
108 public ISchemaUpdater
getNextUpdater() {
113 public ISchemaUpdater
getPreviousUpdater() {
114 return SchemaUpdater_33_331
.NewInstance();