Re: Mapping/DB Migration tool

From: "MC Moisei" <mcmoisei(at)hotmail(dot)com>
To: reece(at)harts(dot)net
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Mapping/DB Migration tool
Date: 2006-07-25 22:21:28
Message-ID: BAY103-F7EAC44DFE8A0E0319FD6FD55A0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)harts(dot)net>
>To: MC Moisei <mcmoisei(at)hotmail(dot)com>
>CC: pgsql-general <pgsql-general(at)postgresql(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Redefined Horizons 2006-07-25 22:44:54 Executing an SQL query from an internal function...
Previous Message Jessica M Salmon 2006-07-25 21:51:27 loop with circular updates