mimecorg / webissues

WebIssues team collaboration system.
https://webissues.mimec.org/
GNU Affero General Public License v3.0
59 stars 14 forks source link

Issue id not sequential #34

Closed mguinness closed 3 years ago

mguinness commented 3 years ago

I've installed WebIssues 2.0.2 with MySQL and noticed that the issue id isn't sequential but skipping by two, i.e. 1, 4, 7, 10 etc.

I looked at the table schema and see that the primary key on issues isn't using AUTO_INCREMENT - is that expected?

I see that there is a getInsertId function for each db engine and that MySQL is using mysqli_insert_id function.

https://github.com/mimecorg/webissues/blob/a894897c492e391c2de6a2388aa60ed33fe1a752/system/db/mysqli/engine.inc.php#L164-L167

The db engine for MS SQL is using @@IDENTITY so I assume that it's using an identity column definition?

https://github.com/mimecorg/webissues/blob/e8e56c6642f913c406854e40cd7f6d7986e607ac/system/db/mssql/engine.inc.php#L224-L232

The system still works OK, but it's strange to see the id not being sequential. Is this a bug or expected behavior?

mimecorg commented 3 years ago

This is expected behavior. The IDs are used not only for issues, but also for comments, attachments and other changes. There is an auto increment key in the stamps table.

mguinness commented 3 years ago

Thank you for explaining that and the purpose of the stamps table.