The table's AUTO_INCREMENT property does not increase by any value every after INSERT - it is stuck on a specific integer value.
I'm testing my project on my Local Computer. As it is, i have a (After INSERT) Trigger that is highly dependent on the AUTO_INCREMENT property of a table as i am updating a field and inserting a string with the LAST INSERTED ID appended as a Suffix. However, no matter how many times i run an INSERT Query, the AUTO_INCREMENT value does not increment.
Here is what the table's content looks like:
And this is the table's properties/option values:
I have also consulted information_schema.TABLES but it also says that AUTO_INCREMENT has the value of 4 - which should technically be 5... right?:
i am worried that this issue might get replicated on the Production Server, as this - my trigger is highly dependent on "that" AUTO_INCREMENT's value. Having it not solved would result in duplicating values, which is unacceptable to the system i am working on. This is the Trigger Definition that is dependent on the AUTO_INCREMENT value:
i expect that the AUTO_INCREMENT value should equal the table's ID field with Auto Increment enabled. in this case they (the ID and the AUTO_INCREMENT value should both be the value of 5.
my database is a copy of the live database which has been dumped into a .sql file and restored on my local mysql instance:
CREATE TABLE `imei` (
`imei_id` int(11) NOT NULL AUTO_INCREMENT,
`identity_imei` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci GENERATED ALWAYS AS ((case when (`imei_from` = _utf8mb3'board') then `board_imei` when (`imei_from` = _utf8mb3'dcover') then `auto_generated_imei` when (`imei_from` = _utf8mb3'sim_tray') then `auto_generated_imei` when (`imei_from` = _utf8mb3'sticker') then `auto_generated_imei` end)) VIRTUAL NOT NULL,
`board_imei` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`auto_generated_imei` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
`expected_imei` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`imei_from` enum('board','dcover','sim_tray','sticker') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`generated_by_id` int(11) NOT NULL,
`date_generated` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`imei_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;