Open pryazhnikov opened 6 years ago
Right now tables.sql has this condition:
tables.sql
SUBSTRING_INDEX(TABLE_NAME, "_", 1)
This condition works well against table names like 'user_photos_123', but fails against other variations:
SELECT SUBSTRING_INDEX("Users123", "_", 1); # => Users123 SELECT SUBSTRING_INDEX("UserPhotos123", "_", 1); # => UserPhotos123 SELECT SUBSTRING_INDEX("user_photos_123", "_", 1); # => user
There is an obvious solution at MySQL 8.0:
## "TABLE_NAME_123" => "TABLE_NAME_" SELECT REGEXP_REPLACE("TABLE_NAME_123", "[0-9]+$", "");
Right now
tables.sql
has this condition:This condition works well against table names like 'user_photos_123', but fails against other variations: