jonbeckett / virtualflightonlinetransmitter

6 stars 6 forks source link

Duplicates in "Positions" table #7

Open Gilbertdelyon opened 1 month ago

Gilbertdelyon commented 1 month ago

We cannot find why, but from time to time we have duplicates in the "Positions" table. It occurs very rarely, so it is not easy to catch the origin of this issue.

In the database.sql we have: KEYPosition_Index(Callsign,GroupName)

My idea would be to replace by: PRIMARY KEY (Callsign) So that duplicate cannot happen. It suit our needs and it works! But may be some unexpected side effects? What do you think?

jonbeckett commented 1 month ago

You're welcome to try any mods out :)

On Fri, 10 May 2024, 14:43 Gilbertdelyon, @.***> wrote:

We cannot find why, but from time to time we have duplicates in the "Positions" table. It occurs very rarely, so it is not easy to catch the origin of this issue.

In the database.sql https://github.com/jonbeckett/virtualflightonlinetransmitter/blob/830a30267b06c92fd7c46bc0f75bbb82a79906b5/server/database.sql#L24 we have: KEY Position_Index (Callsign,GroupName)

My idea would be to replace by: PRIMARY KEY (Callsign) So that duplicate cannot happen. It suit our needs and it works! But may be some unexpected side effects? What do you think?

— Reply to this email directly, view it on GitHub https://github.com/jonbeckett/virtualflightonlinetransmitter/issues/7, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACP7H3L2AAD3LAOXVULEOLZBTFGZAVCNFSM6AAAAABHQVEQZGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI4DSNZWGE4DGOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jonbeckett commented 1 month ago

It shouldn't make a difference. The code looks for the call sign before inserting or updating. Of course that doesn't stop people using the same call sign and keying it slightly differently.

On Fri, 10 May 2024, 14:43 Gilbertdelyon, @.***> wrote:

We cannot find why, but from time to time we have duplicates in the "Positions" table. It occurs very rarely, so it is not easy to catch the origin of this issue.

In the database.sql https://github.com/jonbeckett/virtualflightonlinetransmitter/blob/830a30267b06c92fd7c46bc0f75bbb82a79906b5/server/database.sql#L24 we have: KEY Position_Index (Callsign,GroupName)

My idea would be to replace by: PRIMARY KEY (Callsign) So that duplicate cannot happen. It suit our needs and it works! But may be some unexpected side effects? What do you think?

— Reply to this email directly, view it on GitHub https://github.com/jonbeckett/virtualflightonlinetransmitter/issues/7, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACP7H3L2AAD3LAOXVULEOLZBTFGZAVCNFSM6AAAAABHQVEQZGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI4DSNZWGE4DGOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Gilbertdelyon commented 1 month ago

that doesn't stop people using the same call sign and keying it slightly differently

What do you mean? If it's differently keyed it's not the same, so, the PRIMARY KEY will be different and a new line will be added To prevent someone using exactly the same callsign as an existing one I have in mind to also check the IPAddress.