fix(db): add double index for right side of unique compound indexes
fixes #426
This commit is contained in:
@@ -71,6 +71,7 @@ func (db *DB) Migrate(ctx MigrationContext) error {
|
|||||||
construct(ctx, "202311062259", migrateArtistAppearances),
|
construct(ctx, "202311062259", migrateArtistAppearances),
|
||||||
construct(ctx, "202311072309", migrateAlbumInfo),
|
construct(ctx, "202311072309", migrateAlbumInfo),
|
||||||
construct(ctx, "202311082304", migrateTemporaryDisplayAlbumArtist),
|
construct(ctx, "202311082304", migrateTemporaryDisplayAlbumArtist),
|
||||||
|
construct(ctx, "202312110003", migrateAddExtraIndexes),
|
||||||
}
|
}
|
||||||
|
|
||||||
return gormigrate.
|
return gormigrate.
|
||||||
@@ -802,3 +803,13 @@ func migrateTemporaryDisplayAlbumArtist(tx *gorm.DB, _ MigrationContext) error {
|
|||||||
WHERE tag_album_artist=''
|
WHERE tag_album_artist=''
|
||||||
`).Error
|
`).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func migrateAddExtraIndexes(tx *gorm.DB, _ MigrationContext) error {
|
||||||
|
return tx.Exec(`
|
||||||
|
CREATE INDEX idx_track_genres_genre_id ON "track_genres" (genre_id);
|
||||||
|
CREATE INDEX idx_album_genres_genre_id ON "album_genres" (genre_id);
|
||||||
|
CREATE INDEX idx_album_artists_artist_id ON "album_artists" (artist_id);
|
||||||
|
CREATE INDEX idx_track_artists_artist_id ON "track_artists" (artist_id);
|
||||||
|
CREATE INDEX idx_artist_appearances_album_id ON "artist_appearances" (album_id);
|
||||||
|
`).Error
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user