Re: Code Organisation

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Ravi Chemudugunta" <chemuduguntar(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Code Organisation
Date: 2008-11-19 03:55:10
Message-ID: dcc563d10811181955xbe936c3ha348e0f3196341c9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Nov 18, 2008 at 6:38 PM, Ravi Chemudugunta
<chemuduguntar(at)gmail(dot)com> wrote:
> Hi,
>
> I realise this may be a subjective topic ; however:
>
> what does everyone think about grouping a set of functions together,
> by related it maybe that they call on each other but more so live in
> the same file on disk (before they get submitted) ... we are trying to
> use the output of pg_dump for versioning rather than having our own
> file for e.g. inventory.sql under the tree somewhere.
>
> (does anyone have any ideas on the topic of version control itself ?)
>
> The only problem with doing it this way is once the functions get
> admitted into the database (and our inventory.sql file is deleted
> because it will incorporated into pg_dump somewhere) all context is
> lost,

You're halfway there. Just make a table called something like
changetrack (id int primary key, description text); and then every
update to your database make it look something like this:

begin;
insert into changetrack (id,description) values (1,'First update,
create simple schema');
create table...
alter table...
yada yada yada
commit;

and repeat that for each update. Then you can see which were applied
just by looking at your changetrack table. You can have multiple
updates in a file, and group the ones together into individual
transactions that make sense.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paul Laughlin 2008-11-19 08:57:33 pg_standby and read only filesystems
Previous Message Ravi Chemudugunta 2008-11-19 01:38:04 Code Organisation