Antville Project

proposal: new database schema

to ensure that antville works with other databases than mysql in the backend we must change table- and column-names to avoid the use of reserved words (eg. "USER" is a reserved word in oracle and PostgreSQL). therefor i'd like to propose the following naming-convention:

  • every table's name is prefixed with "AV_" (for "Antville").
  • every column-name is prefixed with a three-character abbreviation of the table-name this column belongs to (plus some of the tables are renamed too): ACC_ in table AV_ACCESSLOG CHO_ in table AV_CHOICE FIL_ in table AV_FILE (the former GOODIE-table) IMG_ in table AV_IMAGE MBS_ in table AV_MEMBERSHIP (the former MEMBER-table) PLL_ in table AV_POLL SKN_ in table AV_SKIN SLG_ in table AV_SYSLOG TXT_ in table AV_TXT USR_ in table AV_USER VTE_ in table AV_VOTE SIT_ in table AV_SITE (the former WEBLOG-table)
  • primary keys are named [table-abbreviation]_ID
  • foreign keys are named [table-abbreviation]_F_[foreign table][_meaning], eg. IMG_F_USR_CREATOR, TXT_F_SIT, TXT_F_TXT_STORY, IMG_F_IMG_THUMB etc. (as an alternative, foreign keys could also be named as they're now (plus the abbreviation-prefix), but i personally think it's less consistent: think of TXT_CREATOR which actually references a record in the usertable). anyway, this is imo one of the points we should discuss

as a result the following prototypes should be renamed:

  • weblog -> site
  • goodie -> file (although this could easily be confused with File i agree with hns that it's easier to understand for users)
  • member -> membership
  • membership -> membermgr (the mountpoint "members" stays the same)

and for consistency-reasons the column AUTHOR in AV_TEXT should be renamed to TXT_F_USR_CREATOR (this is the only occurrence of AUTHOR in the whole db-structure).

please let me know what you think about it.

links: Oracle Reserved Words (v.9i) SQL Key Words (PostgreSQL) MySQL Reserved words

comment    

 
tobi, June 19, 2002 at 5:35:11 PM CEST

half the way

thanks robert for your suggestions. i can follow half the way, until the foreign keys rush in (ie +1 for table and column abbreviations so far).

concerning the foreign keys i don't have a better proposal but it makes me feel dizzy to read bafflegab like TXT_F_TXT_STORY (does this really mean that this is a foreign key pointing from the TEXT table to the TEXT table? well, probably for a comment, right? i also don't understand TXT_F_SIT... where's the third part here, the meaning?)

probably worth a discussion. or maybe i must get some more lessons in abstract thinking...

link  

 
robert, June 19, 2002 at 6:46:04 PM CEST

i know

it's confusing (that's why i wanted to discuss this here ;-), although it's less confusing for me because i already have to deal with such naming conventions. to explain: yes, TXT_F_TXT_STORY is a foreign key pointing to the same table (for comments), and the "meaning" is optional: we need to distinguish what was formerly named CREATOR and MODIFIER which both point to the USER-table, so we can't use simply TXT_F_USER. so: no "meaning"-suffix if there's no need to distinguish two columns pointing to the same foreign table.

link  

 
stefanp, June 19, 2002 at 7:18:21 PM CEST

what about the abbrev.?

having spent a day on another database definition that follows the above conventions, I can clearly see the advantages of the foreign-key-rule, and, too, the per-table-prefixes help the brain a lot.

but what about leaving away the techie table-abbreviations and use the most verbose db-scheme instead? especially for antville it's not that much more writing as most tablenames only consist of 4 or 5 letters.

link  

 
hns, June 19, 2002 at 10:28:32 PM CEST

+2 (considering my previous +1)

on using the whole table name as prefix (if I got that right).

link  

 
robert, June 19, 2002 at 11:48:51 PM CEST

not so sure

MEMBERSHIP_F_USER_CREATOR or IMAGE_F_IMAGE_THUMB for sure is readable, but imho it's much too verbose (i know that i renamed the table MEMBER to MEMBERSHIP, but i did because it contains membership-records ;-). the abbreviations might be confusing at first, but i think that anyone who needs to use them in a hand-typed sql-statement has already digged deep into antville, and this means that this person should have at least a basic knowledge about the db-schema (which in this case also means "learning" the abbreviations). everybody else must not care about them.

link  

 
tobi, June 20, 2002 at 9:38:44 AM CEST

verbose is good

at least for me, so +1 for the whole table names. because i don't have to deal with how a table is abbreviated, then.

link  

 
robert, June 20, 2002 at 9:49:26 AM CEST

ok

let's be verbose.

link  


... comment
 
hns, June 19, 2002 at 6:27:11 PM CEST

I think

it's very important that we fix the db schema so it works on all databases. (Btw, I think it would be a good idea to try to add all the columns we know we'll need in the same swoosh, like for instance the per-story comment flag in the text table.) I must say that I don't like the per-table prefixes very much, it results in a very techie looking schema that's not very easy to memorize. If it's possible I'd prefer to just find names that aren't reserved in any system (like, for example, STORY instead of TEXT), but on the other hand, you don't have to deal with column names very often when programming in antville, so this is no vote against it, just a slight personal preference. Similar with the foreign keys naming conventions. I actually think it's clear from the type properties files what key relates to what column, so I don't really feel the need for such a formal convention (but I don't have a big problem with it either). +1 on the new names for the table names themselves (e.g. SITE instead of WEBLOG).

link  

 
robert, June 19, 2002 at 6:38:34 PM CEST

yes

we should definetly add all columns that we know will be needed in the near future (i'd add also the columns that are needed by your story-extension, hns). not just to reduce the number of upcoming db-patches, but also because changing a db-schema in oracle is really a pain.

regarding column-names: i'm not very happy with table-prefixes either, but i think it's the safest way to go. i thought of renaming i.e. USER to MEMBER, but that would just create another inconsistency (we would have to map the prototype user to MEMBER ...), and then there is FILE ...

and thanks to helma one doesn't have to do much with SQL-statements ;-)

link  

 
hns, June 19, 2002 at 7:02:01 PM CEST

bottom line

+1 from me.

link  


... comment


The Antville Server Fund has been a great success. Thanks to everybody who contributed!
online for 8550 Days
last updated: 1/4/11, 10:22 AM
status
Youre not logged in ... Login
menu
November 2024
SunMonTueWedThuFriSat
12
3456789
10111213141516
17181920212223
24252627282930
July
recent
zfuture's house here is zfuture's
house
by zfuture (7/31/03, 2:59 AM)
i understand your concerns however,
i hardly can think of a solution. certainly, if the...
by tobi (7/29/03, 9:47 AM)
Found several more similar sites
listed This is getting to be quite a concern to...
by cobalt123 (7/27/03, 7:56 PM)
Second Post Alert on Referrer
bug livecatz I put this into "help" and now here:...
by cobalt123 (7/26/03, 7:14 PM)
well it's not easy to
find from here, anyway. think we should include a link,...
by tobi (7/24/03, 11:25 AM)
So finally I found
the helma Bugzilla - stupid me.
by mdornseif (7/24/03, 10:28 AM)
clock not that it's particularly
earthshattering but the antclock is running slow by about 15...
by kohlehydrat (7/23/03, 8:25 PM)
but blogosphere.us isn't can't really
be rated as spam can it?
by kohlehydrat (7/23/03, 8:08 PM)
More referrer spam www.webfrost.com
by Irene (7/23/03, 7:55 PM)
How to log skin names
I accessed to console?? Hi, I would like to know...
by winson (7/23/03, 4:12 PM)

Click here to get an XML version of this weblog.

Made with Antville
powered by
Helma Object Publisher