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
- blocks
-
XWIKI-883 access right cannot be updated if too many users or groups selected
- Closed
-
XWIKI-1459 keep document history in a separate table
- Closed
- relates to
-
XWIKI-1854 Display information to users when the store migration system executes
- Closed
-
XWIKI-1900 Allow database migrations also for multiwikis
- Closed