🔧 chore(db): drop legacy single-column UNIQUE indexes to prevent duplicate-key errors after soft-delete Why Previous versions created single-column UNIQUE constraints (`models.model_name`, `vendors.name`). After introducing composite indexes on `(model_name, deleted_at)` and `(name, deleted_at)` for soft-delete support, those legacy constraints could still exist in user databases. When a record was soft-deleted and re-inserted with the same name, MySQL raised `Error 1062 … for key 'models.model_name'`. What • In `migrateDB` and `migrateDBFast` paths of `model/main.go`, proactively drop: – `models.uk_model_name` and fallback `models.model_name` – `vendors.uk_vendor_name` and fallback `vendors.name` • Keeps existing helper `dropIndexIfExists` to ensure the operation is MySQL-only and error-free when indexes are already absent. Result Startup migration now removes every possible legacy UNIQUE index, ensuring composite index strategy works correctly. Users can soft-delete and recreate models/vendors with identical names without hitting duplicate-entry errors.
| Name |
Last commit
|
Last Update |
|---|---|---|
| .. | ||
| ability.go | Loading commit data... | |
| channel.go | Loading commit data... | |
| channel_cache.go | Loading commit data... | |
| log.go | Loading commit data... | |
| main.go | Loading commit data... | |
| midjourney.go | Loading commit data... | |
| missing_models.go | Loading commit data... | |
| model_extra.go | Loading commit data... | |
| model_meta.go | Loading commit data... | |
| option.go | Loading commit data... | |
| prefill_group.go | Loading commit data... | |
| pricing.go | Loading commit data... | |
| pricing_refresh.go | Loading commit data... | |
| redemption.go | Loading commit data... | |
| setup.go | Loading commit data... | |
| task.go | Loading commit data... | |
| token.go | Loading commit data... | |
| token_cache.go | Loading commit data... | |
| topup.go | Loading commit data... | |
| twofa.go | Loading commit data... | |
| usedata.go | Loading commit data... | |
| user.go | Loading commit data... | |
| user_cache.go | Loading commit data... | |
| utils.go | Loading commit data... | |
| vendor_meta.go | Loading commit data... |