1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package com.xpn.xwiki.store.migration.hibernate

File R43000XWIKI6691DataMigration.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart3.png
80% of files have more coverage

Code metrics

0
5
4
1
76
42
4
0.8
1.25
4
1

Classes

Class Line # Actions
R43000XWIKI6691DataMigration 41 5 0% 4 7
0.2222222222.2%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20   
21    package com.xpn.xwiki.store.migration.hibernate;
22   
23    import javax.inject.Named;
24    import javax.inject.Singleton;
25   
26    import org.xwiki.component.annotation.Component;
27   
28    import com.xpn.xwiki.XWikiException;
29    import com.xpn.xwiki.store.migration.DataMigrationException;
30    import com.xpn.xwiki.store.migration.XWikiDBVersion;
31   
32    /**
33    * Migration for XWIKI-6691: Reduce the size of the ASE_REQUESTID column to 48-chars.
34    *
35    * @version $Id: 2ce1c5838095b7c3e28e719e863377f021cc3e83 $
36    * @since 4.3M1
37    */
38    @Component
39    @Named("R43000XWIKI6691")
40    @Singleton
 
41    public class R43000XWIKI6691DataMigration extends AbstractHibernateDataMigration
42    {
 
43  0 toggle @Override
44    public String getDescription()
45    {
46  0 return "Reduce the size of the ASE_REQUESTID column to 48-chars";
47    }
48   
 
49  206 toggle @Override
50    public XWikiDBVersion getVersion()
51    {
52  206 return new XWikiDBVersion(43000);
53    }
54   
 
55  0 toggle @Override
56    public void hibernateMigrate() throws DataMigrationException, XWikiException
57    {
58    // Nothing to do here, all the work is done as Liquibase changes
59    }
60   
 
61  0 toggle @Override
62    public String getPreHibernateLiquibaseChangeLog() throws DataMigrationException
63    {
64  0 StringBuilder result = new StringBuilder();
65  0 result.append(" <changeSet id=\"R").append(this.getVersion().getVersion()).append("\" author=\"xwikiorg\">\n")
66    .append(" <preConditions onFail=\"CONTINUE\">\n")
67    .append(" <tableExists tableName=\"activitystream_events\"/>\n")
68    .append(" <columnExists tableName=\"activitystream_events\" columnName=\"ase_requestid\"/>\n")
69    .append(" </preConditions>")
70    .append(" <comment>Reduce the size of the ASE_REQUESTID column to 48-chars</comment>\n")
71    .append(" <modifyDataType tableName=\"activitystream_events\"")
72    .append(" columnName=\"ase_requestid\" newDataType=\"varchar(48)\"/>\n")
73    .append(" </changeSet>\n");
74  0 return result.toString();
75    }
76    }