<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
There were questions on the list about doing it the other way around:
from MySQL to Postgres. <br>
<br>
I have managed to use this tool to migrate RT 3.0.10
the other way around -- from mysql to postgres.<br>
<br>
The procedure was:<br>
<ol>
<li><b>rt-setup-database --action schema ...<br>
</b></li>
<li>Download
<a class="moz-txt-link-freetext"
href="http://fsck.com/pub/rt/contrib/3.0/Conversion/rt3-on-pg-to-mysqlModify">http://fsck.com/pub/rt/contrib/3.0/Conversion/rt3-on-pg-to-mysql</a></li>
<li>Modify the script to reflect database locations, e.g.:<br>
</li>
<ul>
<li>my $new_handle =
DBI->connect("dbi:Pg:dbname=rtdb",'postgres','')<br>
or die $DBI::errstr;</li>
<li>my $old_handle =<br>
DBI->connect("dbi:mysql:database=rt3;host=<my-old-host>;port=3306",'<my_user><br>
','<my password>') or die $DBI::errstr;<br>
</li>
</ul>
<li>Switch to PostgreSQL DBA account: <b>su postgres</b></li>
<li>Run the script and make sure it worked OK. At this point you can
login and see tickets, but not create tickets<br>
</li>
<li>Reset the sequences in the database:</li>
<ul>
<li><b>su postgres<br>
psql rtdb</b><br>
</li>
<li>For every SEQUENCE in /etc/request-tracker3/schema.Pg (I am
using Debian; the location on your system may be in /opt/rt3. or
somewhere else) do:</li>
<ul>
<li>SELECT MAX(id) + 1 FROM <table>;</li>
<li>note the result</li>
<li>ALTER SEQUENCE <table>_is_seq RESTART WITH <the
result of the previous statement> ;</li>
</ul>
</ul>
</ol>
NOTES<br>
<ol>
<li><big><small>Usual disclaimer: </small>The above worked for me
once; it is not guaranteed to work for you
and you are strongly advised not to do it on the production database
without prior testing.</big></li>
<li>IMHO ALTER SEQUENCE <table>_is_seq RESTART WITH (SELECT
MAX(id) + 1 FROM <table>) should have worked but it didn't and I
had to split it in two. Postgres/SQL gurus might be able to explain
why. Perl gurus may want to modify Jesse's script to do all this
automagically.<br>
</li>
<li>In my totally unscientific Apples-to-Oranges comparison moving
database to Postgres actually made things faster, contrary to what many
people
experience.</li>
</ol>
<br>
Jesse Vincent wrote on 04/11/2004 4:12 PM:<br>
<blockquote cite="mid20030815071633.GB10198@fsck.com" type="cite">
<pre wrap="">Is now available at <a class="moz-txt-link-freetext"
href="http://fsck.com/pub/rt/contrib/3.0/Conversion/">http://fsck.com/pub/rt/contrib/3.0/Conversion/</a>
It's a small tool I built for a client who wanted to move from Pg to
Mysql with their existing RT3 database.
You should start with a full RT database on postgres and an RT3 database
on mysql that contains only the schema and not the database content.
-j
</pre>
</blockquote>
</body>
</html>