Order management system - multiple data sources

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Order management system - multiple data sources

Post by Luke »

I am currently writing an order management system for a client of ours. They have 3 main sources of sales... and all of these sources can have their own "order number" or "invoice number" or what-have-you. I am having a hard time making a design decision on how I should manage this on the database level. I need to be able to sort all these orders by their source, as well as look them up by their source's order number. There is a possibility (although slight) that because of the multiple sources, I could end up with two orders with the same id. I'm not even going to tell you guys how I am doing it now, because I want to get un-tainted advice. My solution is proving to be very difficult to keep straight, and I just want some advice. Thanks! :)
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Re: Order management system - multiple data sources

Post by jmut »

Well first obvious solution sounds like you need composite PK, like PK(source_id, order_id ) or I didn't understand something.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Re: Order management system - multiple data sources

Post by Luke »

hmm... thats a good idea. right now I have a combined unique key for "source_id" and "source_order_id" but it is not the PK. I have an standard id PK field. I'll play around with that idea.
Post Reply