Remove uniqid field from serial storage table

Created on 18 June 2020, almost 5 years ago
Updated 1 March 2024, about 1 year ago

Problem/Motivation

Currently for each Serial field instance we have a separate table for generating numbers. Each table has the following fields:

  • sid: PK INT
  • uniqid: UNI VARCHAR

When we need to generate new number we just insert new record into this table. The last_insert_id() gives us new number. The big question is: why do we have uniqid field? It's not used anywhere, so it's useless. But it can cause problems. It has UNIQUE constraint (which means the value cannot be repeated). And we use uniqid() PHP function to generate the value for that field. As described in documentation this function does not guarantee that the value will be unique. I know that in real life the collisions are almost impossible. But this is "almost impossible", but not "completely impossible". And since it's not used anywhere, I think that field must not exist.

Proposed resolution

Remove uniqid field from the serial storage tables and update INSERT statement to insert row without values.

Remaining tasks

Review, other opinion needed.

User interface changes

None.

API changes

None.

Data model changes

The uniqid field will be removed from serial storage table.

πŸ“Œ Task
Status

RTBC

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine mpolishchuck

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024