|
|
We need to perform the following tasks:
Possible solutions to migrate tickets from old Trac project to new Trac project:
create hot-copy of trac:
trac-admin /path/to/projenv hotcopy /path/to/backupdir
create a tar archive of hot backup:
tar -czvf trac-2013-07-2.tar.gz /cars/archive/trac-hot-copy-backup
on your workstation scp tar archive:
cd ~
mkdir trac
cd trac
scp old-server:/cars/archive/trac-2013-07-2.tar.gz .
unarchive:
tar xzvf trac-2013-07-2.tar.gz
create virtualenv:
cd trac-hot-copy-backup
virtualenv .env
source .env/bin/activate
install Genshi==0.6 because Trac==0.12.2 breaks with Genshi==0.7:
pip install Genshi==0.6
install Trac==0.12.2:
pip install Trac==0.12.2
test setup:
tracd --port=8800 --env-parent-dir ~/trac/
open browser to http://127.0.0.1:8800
bring hot-copy tracd server offline
Update the Trac Code to Trac==1.0:
# optional, but these directories are no longer used
#rm -rf ~/trac/trac-hot-copy-backup/htdocs/ ~/trac/trac-hot-copy-backup/templates/
pip install Trac==1.0
Upgrade the Trac environment:
trac-admin ~/trac/trac-hot-copy-backup upgrade
trac-admin ~/trac/trac-hot-copy-backup wiki upgrade
test setup:
tracd --port=8800 --env-parent-dir ~/trac/
bring hot-copy tracd server offline
Update the Trac Code to Trac==1.0.1:
# optional, but these directories are no longer used
#rm -rf ~/trac/trac-hot-copy-backup/htdocs/ ~/trac/trac-hot-copy-backup/templates/
pip install Trac==1.0.1
Upgrade the Trac environment:
trac-admin ~/trac/trac-hot-copy-backup upgrade
trac-admin ~/trac/trac-hot-copy-backup wiki upgrade
test setup:
tracd --port=8800 --env-parent-dir ~/trac/
move to db directory:
cd ~/trac/trac-hot-copy-backup/db
dump each table related to tickets:
sqlite3 trac.db ".dump ticket" > trac_ticket.sql
sqlite3 trac.db ".dump ticket_change" > trac_ticket_change.sql
sqlite3 trac.db ".dump ticket_custom" > trac_ticket_custom.sql
sqlite3 trac.db ".dump ticket_template_store" > trac_ticket_template_store.sql
sqlite3 trac.db ".dump attachment" > trac_attachment.sql
sqlite3 trac.db ".dump milestone" > trac_milestone.sql
sqlite3 trac.db ".dump pastes" > trac_pastes.sql
copy *.sql to the new trac project db directory
become trac user:
sudo su - trac
bash
import the tables:
cat trac_ticket.sql | sqlite3 trac.db
cat trac_ticket_change.sql | sqlite3 trac.db
cat trac_ticket_custom.sql | sqlite3 trac.db
cat trac_ticket_template_store.sql | sqlite3 trac.db
cat trac_attachment.sql | sqlite3 trac.db
cat trac_milestone.sql | sqlite3 trac.db
cat trac_pastes.sql | sqlite3 trac.db
copy files/attachments directory from hot-copy to new Trac project. Make sure owner:group is trac:trac:
chown -R trac:trac files/attachments
KEEP - meta data for attachment files. Also need underlying attachment directory.
DROP - cookie session data for logged in users
DROP - only record: 901198563trac.wiki.api.WikiSystem.pages
DROP - we plan to create new components via config management
DROP - we plan to create new enums (priority, severity, ticket_type, resolution) via config management
KEEP - we have 7 records that need to be moved, Trac defaults to Milestone 1, 2, 3, 4
DROP - empty
KEEP - we need to install paste plugin
DROP - we don't need to migrate old permissions. we need a plan to place in config management
DROP - we don't need old reports. we might want to back them up as examples
DROP - empty
DROP - empty
DROP - session data for when people logged in and what they did to the trac system
DROP - session data for when people logged in and what they did to the trac system
KEEP but DROP - we might need to transform this data to work with new subticket plugin
DROP - version numbers of plugins and modules
KEEP - tickets
KEEP - ticket history
DROP - ticket custom fields, lots of garbage from old plugins. We will be generating a migration from subticket to new childticket plugin that will insert into this table.
KEEP - ticket templates which auto fill body message with text, discuss this
DROP - empty
DROP - discuss, we could migrate everything or we could migrate some pages
dump out the data and edit with vim
sqlite3 trac.db
sqlite> .mode csv
sqlite> .out trac_subtickets.csv
sqlite> SELECT child,parent FROM subtickets;
sqlite> .exit
vim trac_subtickets.csv
run the following search and replace transformations:
%s/,/,"parent","#/g
%s/$/");/g
%s/^/INSERT INTO "ticket_custom" VALUES(/g
rename
cp trac_subtickets.csv trac_ticket_children.sql
Source: https://foxhop.net/f3cf047c-2f95-11f1-8298-e86a64d24d78/trac-upgrade-and-migration
Snapshot: 2026-05-25T01:47:30Z
Generator: Remarkbox 1527ef7