Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-1569

Store migration system

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1 M3
    • Fix Version/s: 1.2 M1
    • Component/s: Storage
    • Labels:
      None
    • keywords:
      DBImprovement
    • Similar issues:

      Description

      XWiki needs migration system for easy migrate from old database.
      XWIKI-883, XWIKI-1459, XWIKI-1468 needs migration.

      Implementation:
      1. store special xwiki data version number in database (svn revision number)
      2. migrations will be like patches from one data version to another.
      3. migrations runs from XWiki.initXWiki, after all store systems initialized, but xwiki initialization is not finish. So migrations can use store system. (high-level)
      4. migration can be turned off at xwiki.cfg (off by default for tests. parameter xwiki.store.migration)
      5. some migrations can be forced or ignored at xwiki.cfg (parameters xwiki.store.migration.ignore=verions, xwiki.store.migration.force=classnames)

      Questions:
      1. How identify migrations?
      Will it be class extends Migrator with name "R" + svn revision number + jiraIssue+"Migrator"?
      2. How register migrations in migrationManager?
      Register all classes in package "com.xpn.xwiki.store.migration.hibernate" via classloader?

      Example use case:

      /**
       * Migrator for something. Jira issue XWIKI-1234.
       * @version $Id: $
       */
      public class R4326XWiki1234Migrator extends AbstractXWikiHibernateMigrator
      {
          /** {@inheritDoc} */
          public XWikiDBVersion getVersion()
          {
              return new XWikiDBVersion(4326);
          }
          /** {@inheritDoc} */
          public void migrate(XWikiHibernateMigrationManager manager, XWikiContext context)
              throws XWikiException
          {
              manager.getStore(context).executeWrite(context, true, new HibernateCallback() {
                  public Object doInHibernate(Session session) throws HibernateException
                  {
                      // here you can write migration
                      return null;
                  }
              });
          }
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              amelentev Artem Melentev
              Reporter:
              amelentev Artem Melentev
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: