structure - MySQL documents linking -
i have 4 tables:
- orderforms
- deliverynota
- invoices
- creditnota
what make possible link of document other document. example creditnote id 10 linked invoice id 155. orderform 17 linked deliverynote 10.
i see 3 possible solutions:
- create table every link ex.: orderform_link_diliverynote, orderform_link_invoice, orderform_link_creditnote, deliverynote_link_invoice, ...
- table "document_linking" 5 columns: link_id, orderform_id, deliverynote_id, invoice_id, creditnote_id.
- table "document_linking" once again 5 cols, in following way: link_id, documentype_one (eg.: invoice, creditnote, ...), document_id_one, document_type_two (eg.: invoice, creditnote, ...), document_id_two
i personaly prefer last one, in opinion dynamic solution. if ever add 1 or more doctypes, able without changing document_linking table. other advantage, in opinion, can link documents of thesame type.
as don't have experience on kind of linking, ask advice. every kind of welcome (articles, books, tips, ...), haven't found usefull on web :(
Comments
Post a Comment