Help with database structure

0

I have a system for sending files and I have control in two tables, one to save file names and status of sending and processing, and another in which I keep the details as error messages when sending or success when processing.

Now I have the need to send the same file to two different destinations and I need to keep track of the files that are sent to the second destination

As a first step it occurred to me to add other colunmas to the tables that I already have to add the shipping status for the second destination, but analyzing a control to know to which destination if it was sent and which would not be unruly to see the table directly

Another option is to create two other tables and use them to bring exclusive control to that destination.

Which do you think would be the best and / or what other option would you recommend?

    
asked by Juan Manuel 15.09.2018 в 18:21
source

2 answers

2

The best option would be to make a table (BD) where you relate the message to the destination, because as you say a message can be sent to several destinations, then the table would have the id of the message and the id of the destination:

Relational table between the message and the destination:

---------------------------
|     destino_mensaje     |
---------------------------
| id_mensaje | id_destino |
---------------------------
| 1          | 1          |
---------------------------
| 1          | 2          |
---------------------------
| 1          | 4          |
---------------------------
| 2          | 1          |
---------------------------

With this you can add several destinations to a single message

    
answered by 15.09.2018 в 18:28
0

Edit: @David does not land your idea very well, this is the structure of the tables that I currently have:

-----------------            ----------------
|   fileshead   |            |   filesdet   |
-----------------            ----------------
| id            |            | id           |
-----------------            ----------------
| periodo       |            | idhead       |
-----------------            ----------------
| archivo       |            | errid        |
-----------------            ----------------
| status_envio  |            | description  |
-----------------            ----------------
| retry_envio   |            | tiporeg      |
-----------------            ----------------
| status_proces |           
-----------------           
| retry_proces  |           
-----------------         

files are saved in fileshead as period and name and the status of the shipment, and in filesdet the details are saved when sending or processing the file now to handle a second destination is where I am seeing how to do it, with your idea occurs to me to add a field that in fileshead that is called destiny and do a double insertion of the registry with the difference that the destination field will give the pattern to be able to control where to send each file, and filesdet would be the same keeping the record of the file, but I feel that this would duplicate the information in the fileshead table

    
answered by 29.09.2018 в 20:54