'gncentry' table mis-named

Linas Vepstas linas@linas.org
Mon, 4 Mar 2002 13:41:44 -0600

On Mon, Mar 04, 2002 at 10:56:32AM -0500, Derek Atkins was heard to remark:
> > > However, I've already got another object called a
> > > 'GncEntry', so I'd like to use that table name.
> > > 
> > > I'd like to rename the gncEntry table to gncJournalEntry.
> > > 
> > > Any objections?
> > 
> > Well, to do this, you need to write the upgrade script that will copy
> > existing tables by this name to the new name.  You'd also need to  erase
> > existing stored proceedures that use this name, and recreate thenm with
> > the new name. And so on.  (src/backend/postgres/upgrade.c) This isn't 
> > hard, but its not fool-proof either.  I think the risk of introducing 
> > new bugs outweighs the name change ... 
> Perhaps.  How many stored procedures are there?

Maybe a half dozen.  The real point is that there is an architected way
to upgrade an existing gnucash database (as opposed to a global copy).
Its not 'hard', but its not trivial, and it is error-prone if only
because its under-tested.

> > Wouldn't it be easier to rename the business-object-entry into something
> > more descriptive?  Or if that doesn't work, how about calling the
> > sql table something like GncBOEntry? I think that would be a lot easier
> > ...
> Maybe.  Maybe not.
> I'm trying to make everything as "data-driven" and pluggible as
> possible.  This includes the backends.  In fact, later today I'm going
> to commit a change that basically allows modules to "plug in" new data
> types into the backends.  Currently only the file (xml) backend
> supports this new extension.

I've spent some fair amount of time thinking about this type of generic
problem (because gnucash isn't the  only app with this problem) but have
done zero about it.  I want to make it super-easy to add an sql backend
to an existing app.

> The downside is that due to the way this works you cannot special-case
> names of objects.  If an object is named "foo" then it is called
> "foo".  Herein arrises the problem.  You've "special-cased" a split
> into something else.

I would strongly encourage adding a name-mapping between the 
c-object name and the sql-table name.  I'm not sure how general your
mechanism is, but if you have any hope of getting more general than what
gnucash needs, having this kind of mapping would be a must-have feature.


pub  1024D/01045933 2001-02-01 Linas Vepstas (Labas!) <linas@linas.org>
PGP Key fingerprint = 8305 2521 6000 0B5E 8984  3F54 64A9 9A82 0104 5933