Skip site navigation (1) Skip section navigation (2)

Dev DB Structure Updates

From: <operationsengineer1(at)yahoo(dot)com>
To: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Dev DB Structure Updates
Date: 2006-05-11 16:55:19
Message-ID: 20060511165519.75057.qmail@web33311.mail.mud.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-novice
hi all,

i'm reading agile web dev with rails and the author
discusses how he makes text sql snapshots of his
databases.  when a new column needs to be added, for
example, he updates the text sql and reloads the file.

in mysql, he puts a statement like...

if table_example exists delete table_example

that is close, but not the exact code.  he is trying
to delete the existing table (wrong structure) and
replace it with the new structure.

should i uncomment...

-- DROP DATABASE "edb-bms-dev";

to get...

DROP DATABASE "edb-bms-dev";

in order to get similar behavior?i tried using the if
table_example exists dyntax in pgsql and it didn't
work.

when i was using a similar strategy, except at the
table level, the output kicked out an error saying the
table wasn't there.  however, the update went as
expected - i thought the error was strange and must've
had something to do with me dropping the table.

is this the best way to control db revisions and make
updates?  one facet of this plan that appeals to me is
that i can control column order within the db.  this
is important when using rails b/c rails displays the
columns in order when it generates its web pages, by
default.

i'd appreciate hearing what others do.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Responses

pgsql-novice by date

Next:From: Sean DavisDate: 2006-05-11 17:06:28
Subject: Re: Dev DB Structure Updates
Previous:From: Mark CampbellDate: 2006-05-11 11:21:48
Subject: Compiling on 8.1.3 on Openserver 5.05

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group