Thanks Horst

Horst Herb wrote:

On Friday 20 October 2006 15:15, Richard Hosking wrote:
 item_1 VARCHAR(20) NOT NULL,
   item_2 VARCHAR(20),
   item_3 VARCHAR(20),
   item_4 VARCHAR(20),
   item_5 VARCHAR(20),

Don't artificially restrict yourself to 5 items - also makes searching for billed items eg for statistics a lot harder

I presume the billing_transaction table has a reference to a second table says items_billed There will another table in this case referring to all the possible item codes.
OK on the transaction keyword

your transaction will have one or more items.
do instead:

create table items (
id serial primary key, transaction_id integer references transactions(id),
       ...
);

You are not likely to ever run lots of queries/time over and over again for all items of a given billing transaction, so there is no advantage in denormalizing here

Re table name "transaction" - this is a reserved word in many SQL dialects.
rather call it billing_transaction or invoice or some such

Doesnt RoR have a method to convert singular names to plural? In this case it seems better to use the singular.

R

It also makes SQL code more readable if you use plural for all table names - only realized that myself afetr reading a lot of RoR code

Horst _______________________________________________
Gpcg_talk mailing list
[email protected]
http://ozdocit.org/cgi-bin/mailman/listinfo/gpcg_talk

_______________________________________________
Gpcg_talk mailing list
[email protected]
http://ozdocit.org/cgi-bin/mailman/listinfo/gpcg_talk

Reply via email to