Modify the script to reflect database locations, e.g.:
* my $new_handle =
DBI->connect(“dbi:Pg:dbname=rtdb”,‘postgres’,‘’)
or die $DBI::errstr;
* my $old_handle =
DBI->connect(“dbi:mysql:database=rt3;host=;port=3306”,‘<my_user>
‘,’’) or die $DBI::errstr;
Switch to PostgreSQL DBA account: su postgres
Run the script and make sure it worked OK. At this point you can
login and see tickets, but not create tickets
Reset the sequences in the database:
* su postgres
psql rtdb
* 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:
o SELECT MAX(id) + 1 FROM ;
o note the result
o ALTER SEQUENCE
_is_seq RESTART WITH ;
NOTES
Usual disclaimer: 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.
IMHO ALTER SEQUENCE
_is_seq RESTART WITH (SELECT MAX(id) +
1 FROM
) 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.
In my totally unscientific Apples-to-Oranges comparison moving
database to Postgres actually made things faster, contrary to what
many people experience.