Re: Mapping/DB Migration tool - Mailing list pgsql-general

From MC Moisei
Subject Re: Mapping/DB Migration tool
Date
Msg-id BAY103-F7EAC44DFE8A0E0319FD6FD55A0@phx.gbl
Whole thread Raw
In response to Re: Mapping/DB Migration tool  (Reece Hart <reece@harts.net>)
Responses Re: Mapping/DB Migration tool
List pgsql-general

The main thing is I changed a bunch of date types to timestamp type. Is
there a simple way to change the type on such fields ?

Some fields got renamed and the type changed.

It sounds like doing a copy|template of db1 as db2 and then applying the new
changes as a script that will probably work. The contraints are easy to
migrate once I have the whole structure in place.

Thanks a lot to all for replying to my post that quickly. Keep them coming
if you have more ideas

Regards,
Constantin
http://www.goodstockimages.com




>From: Reece Hart <reece@harts.net>
>To: MC Moisei <mcmoisei@hotmail.com>
>CC: pgsql-general <pgsql-general@postgresql.org>
>Subject: Re: [GENERAL] Mapping/DB Migration tool
>Date: Tue, 25 Jul 2006 14:49:34 -0700
>
>On Tue, 2006-07-25 at 13:59 -0500, MC Moisei wrote:
>
> > I'm looking to migrate psql db1 to a psql db2 that has a different
> > structure
> > even though 70% would be the same.
>
>
>Depending on how much the structure changes (as opposed to more trivial
>things like column names), you might consider whether you could actually
>use the database itself to do this.
>
>For some kinds of changes, and especially those that make destructive
>in-place changes that might require debugging, I've written views which
>generate the SQL statements to execute. I then do something like:
>
>$ psql -Atc 'select sql from sql_changes'  | psql -Xa
>
>This works particularly well when the changes can be computed in some
>way from the database, such as creating indexes for unindexed PKs
>(postgresql doesn't require indexes on PKs).
>
>You'd probably want to do this by making copies of the original database
>as a template ('create database db2 template db1') or createdb -T .
>
>-Reece
>
>--
>Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0



pgsql-general by date:

Previous
From: Reece Hart
Date:
Subject: Re: Mapping/DB Migration tool
Next
From: "Redefined Horizons"
Date:
Subject: Executing an SQL query from an internal function...