Ok this is a long table design question I have been having trouble wrapping my head around.
I have a database my company uses to keep track of equipment that we repair. Currently we have a table 'repairs', with fields like:
ID, customer, equip_type, serial_num, date_received, date_estimate_done, date_estimate_sent, date_PO, date_shipped.
We use all the date fields to keep track of the status of the repair, for example if there is a value in date_received, and date_estimate_done, but date_estimate_sent is null, we know we need to send that estimate to the customer. This has all been working fine for us for a while now.
We occasionally have to send a piece of equipment out to a third party for repair, and what I want to do now is add the ability for the database to keep track of this.
My first thought was to add another date field to the repairs table, say date_senttothirdparty. But we also need to keep track of the vendor, so I would need a vendor field as well, that would only be used when equip was sent out to a third party. Also maybe there is some remote chance that a machine might have to go out twice to two different vendors.
So my second thought is to take all the date tracking out of the main table, and have two tables, something like this:
repairs: ID, customer, equip_type, serial_num
status_log: ID, repairID, date, event, vendor
Then we put things like "Received", "EstimateDone", etc. in the event column. and the vendor column is still only used for the one event, "SentToThirdParty".
The problem with this is it was very easy for me before to have controls on a form editRepair that is bound directly to fields like date_received and date_shipped. And we can then just fill in the received date and shipped date on the form. Now I am not sure how to accomplish the same thing so easily. I would have to maybe have a button that when pressed runs an insert query against the status_log table? I can't figure out the best way to do it. Anybody have any advice?
I have a database my company uses to keep track of equipment that we repair. Currently we have a table 'repairs', with fields like:
ID, customer, equip_type, serial_num, date_received, date_estimate_done, date_estimate_sent, date_PO, date_shipped.
We use all the date fields to keep track of the status of the repair, for example if there is a value in date_received, and date_estimate_done, but date_estimate_sent is null, we know we need to send that estimate to the customer. This has all been working fine for us for a while now.
We occasionally have to send a piece of equipment out to a third party for repair, and what I want to do now is add the ability for the database to keep track of this.
My first thought was to add another date field to the repairs table, say date_senttothirdparty. But we also need to keep track of the vendor, so I would need a vendor field as well, that would only be used when equip was sent out to a third party. Also maybe there is some remote chance that a machine might have to go out twice to two different vendors.
So my second thought is to take all the date tracking out of the main table, and have two tables, something like this:
repairs: ID, customer, equip_type, serial_num
status_log: ID, repairID, date, event, vendor
Then we put things like "Received", "EstimateDone", etc. in the event column. and the vendor column is still only used for the one event, "SentToThirdParty".
The problem with this is it was very easy for me before to have controls on a form editRepair that is bound directly to fields like date_received and date_shipped. And we can then just fill in the received date and shipped date on the form. Now I am not sure how to accomplish the same thing so easily. I would have to maybe have a button that when pressed runs an insert query against the status_log table? I can't figure out the best way to do it. Anybody have any advice?