wiki:TracMigratePlugin

Migrate to new environment with another database

Description

The plugin provides trac-migrate.py script and migrate command of trac-admin which migrates to new environment with another database.

Bugs/Feature Requests

Existing bugs and feature requests for TracMigratePlugin are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from here.

Source

You can check out TracMigratePlugin from here using Subversion, or browse the source with Trac.

Usage without installation

  1. Checkout or export latest source.
    svn co http://trac-hacks.org/svn/tracmigrateplugin/0.12 /path/to/tracmigrateplugin
    
  2. If new environment uses PostgreSQL or MySQL, create database for the new environment. See DatabaseBackend#BackendSpecificInstallationInstructions.
  3. Run trac-migrate.py.
    $ cd /path/to/tracmigrateplugin
    $ ./trac-migrate.py /path/to/source /path/to/destination mysql://tracuser:password@localhost/trac
    Copying tables:
      attachment table... 10 records.
      auth_cookie table... 9 records.
      cache table... 11 records.
    ....
    

Install

  1. Install the plugin for Trac 0.12 or later.
    easy_install http://trac-hacks.org/svn/tracmigrateplugin/0.12
    
  2. Enable the plugin in trac.ini of your source environment.
    [components]
    tracmigrate.* = enabled
    

Example

Usage

$ ./trac-migrate.py
Usage: trac-migrate.py [OPTIONS] SOURCE-TRACENV [DEST-TRACENV] DBURI

  Migrate to new environment with another database or another
  database without creating a new environment.

Options:
  -i, --in-place    migrate without creating a new environment

Examples:
  $ trac-migrate.py /path/to/source /path/to/dest sqlite:db/trac.db
  $ trac-migrate.py /path/to/source /path/to/dest postgres://tracuser:password@localhost/trac?schema=destination
  $ trac-migrate.py /path/to/source /path/to/dest mysql://tracuser:password@localhost/trac
  $ trac-migrate.py --in-place /path/to/source sqlite:db/trac.db
  $ trac-migrate.py --in-place /path/to/source postgres://tracuser:password@localhost/trac?schema=destination
  $ trac-migrate.py --in-place /path/to/source mysql://tracuser:password@localhost/trac

Migration to a new environment

$ ./trac-migrate.py /path/to/source-tracenv /path/to/destination-tracenv postgres://tracuser:password@localhost/trac?schema=destination
Copying tables:
  attachment table... 10 records.
  auth_cookie table... 9 records.
  cache table... 11 records.
  component table... 5 records.
  enum table... 13 records.
  milestone table... 7 records.
  node_change table... 37 records.
  permission table... 17 records.
  report table... 11 records.
  repository table... 5 records.
  revision table... 35 records.
  session table... 2 records.
  session_attribute table... 19 records.
  ticket table... 35 records.
  ticket_change table... 110 records.
  ticket_custom table... 375 records.
  version table... 2 records.
  wiki table... 93 records.
Copying directories:
  attachments directory... done.
  htdocs directory... done.
  templates directory... done.
  plugins directory... done.

Migration to a new database without creating a new environment

$ ./trac-migrate.py --in-place /path/to/tracenv postgres://trac:password@localhost/trac?schema=new_schema
Copying tables:
  attachment table... 31 records.
  auth_cookie table... 5 records.
  cache table... 17 records.
  component table... 6 records.
  enum table... 13 records.
  milestone table... 8 records.
  node_change table... 133876 records.
  permission table... 18 records.
  report table... 11 records.
  repository table... 80 records.
  revision table... 30076 records.
  session table... 5 records.
  session_attribute table... 15 records.
  system table... 3 records.
  tags table... 89797 records.
  tags_change table... 0 records.
  ticket table... 30009 records.
  ticket_change table... 353 records.
  ticket_custom table... 923 records.
  version table... 2 records.
  wiki table... 167 records.
Back up conf/trac.ini to conf/trac.ini.migrate-1392451681 in /path/to/tracenv.

Tickets

Recent Changes

[14071] by jun66j5 on 2014-08-07 09:02:15
tracmigrate: don't pass db parameter for Environment.get_version since the parameter has been removed in 1.1.2dev (refs #11899, trac:r12826)
[14070] by jun66j5 on 2014-08-07 08:43:06
tracmigrate: directly retreive database connection rather than deprecated Environment.get_db_cnx (refs #11899, trac:r13064)
[13809] by jun66j5 on 2014-04-03 07:51:11
tracmigrate: prevent AssertionError from PooledConnection.__del__ on Python interpreter's termination

Author/Contributors

Author: jun66j5
Maintainer: jun66j5
Contributors:

Last modified 7 months ago Last modified on Feb 15, 2014 9:15:08 AM