views:

193

answers:

1

I'm developing a custom trouble ticket system for network management and trying to find the best database table layout for following scenario:

There are tables representing PON, T1 and T3 lines. Each line may have one or more trouble tickets, but every trouble ticket has some unique fields depend on what type of line this tiket belongs.

Here is my approach:

pon:
  pon_id, pk
  ....
  #here other unique pon table columns

t1:
  t1_id, pk
  ....
  #here other unique t1 table columns

t3:
  t3_id, pk
  ....
  #here other unique t3 table columns

ticket:
  ticket_id, pk
  type, string # t1, t3, pon
  type_id, int # id of pon, t1 or t3
  ....
  #here other columns, which are common for all ticket types 


ticket_pon_type:
  ticket_id, pk, fk
  ....
  #here unique pon ticket columns


ticket_t1_type:
  ticket_id, pk, fk
  ....
  #here unique t1 ticket columns


ticket_t3_type:
  ticket_id, pk, fk
  ....
  #here unique t3 ticket columns

I'm building my application using Symfony 1.4 PHP framework with Doctrine ORM.

Any other ideas? Thank you for any help.

+2  A: 

pon, t1 and t3 should be consolidated into a single table. Add a line column to the table so that you can tell whether each record is a pon, t1 or t3.

I think you will find that this will also allow you to consolidate your ticket_type tables.

Robert Harvey
`pon`, `t1`, and `t3` tables have to many unique columns (this is legacy database layout), and what if every ticket type table will have 10 unique columns?
vooD