mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-28 21:44:21 +01:00
Ongoing tests for [turso-go](https://github.com/tursodatabase/turso-go) have unearthed a couple more issues closes #3187 ### Number 1: We were getting something like: ```sql sqlite_autoindex_`databases`_2 ``` when creating autoindex for table in Gorm (gorm is notorious for backticks everywhere), because of not normalizing the column name when creating autoindex. ### Number 2: When creating table with `PRIMARY KEY AUTOINCREMENT`, we were still creating the index, but it wasn't properly handled in `populate_indices`, because we are doing the following: ```rust if column.primary_key && unique_set.is_primary_key { if column.is_rowid_alias { // rowid alias, no index needed continue; // continues, but doesn't consume it.. } ``` So if we created such an index entry for the AUTOINCREMENT... we would trip this: ```rust assert!(automatic_indexes.is_empty(), "all automatic indexes parsed from sqlite_schema should have been consumed, but {} remain", automatic_indexes.len()); ``` Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com> Closes #3186