Re: Migrate from MySQL to PostgreSQL

From: Date: Fri, 23 Jan 2004 12:13:24 +0000
Subject: Re: Migrate from MySQL to PostgreSQL
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-10312@lists.php.net to get a copy of this message
Hi! Andreas Korthaus wrote:
Oh, thank you! I tried my2pg.pl, and it looks good. But what about sequence-tables PEAR::DB created? I would like to migrate the data, so the Ids should be megrated too. my2pg.pl is doing the following: in MySQL PEAR::DB creates such tables for sequences: CREATE TABLE mySequence_seq ( id int(10) unsigned NOT NULL, PRIMARY KEY (id) ) TYPE=MyISAM; my2pg.pl translates this as followed: CREATE SEQUENCE mysequence_seq_id_seq; CREATE TABLE "mySequence_seq" ( "id" INT4 DEFAULT nextval('mysequence_seq_id_seq'), PRIMARY KEY ("id") ); Is that correct - or how should I migrate the max-IDs of my sequences?
PEAR::DB uses native PostgreSQL sequences, so you should do CREATE SEQUENCE mysequence_seq; SELECT setval('mysequence_seq', /* here goes max value from MySQL's "sequence" table */); I think you'll have to edit this manually.

« previous php.pear.general (#10312) next »