Skip to content
Browse files

mysql requires a length for the index on a text column

  • Loading branch information...
1 parent c0ff731 commit ae6508e161df2ff4d5bf1839f42f94affc1c1c05 Jonathan Marshall committed Jul 5, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 xbmc/music/MusicDatabase.cpp
View
4 xbmc/music/MusicDatabase.cpp
@@ -189,7 +189,7 @@ bool CMusicDatabase::CreateTables()
CLog::Log(LOGINFO, "create art table, index and triggers");
m_pDS->exec("CREATE TABLE art(art_id INTEGER PRIMARY KEY, media_id INTEGER, media_type TEXT, type TEXT, url TEXT)");
- m_pDS->exec("CREATE INDEX ix_art ON art(media_id, media_type, type)");
+ m_pDS->exec("CREATE INDEX ix_art ON art(media_id, media_type(20), type(20))");
m_pDS->exec("CREATE TRIGGER delete_song AFTER DELETE ON song FOR EACH ROW BEGIN DELETE FROM art WHERE media_id=old.idSong AND media_type='song'; END");
m_pDS->exec("CREATE TRIGGER delete_album AFTER DELETE ON album FOR EACH ROW BEGIN DELETE FROM art WHERE media_id=old.idAlbum AND media_type='album'; END");
m_pDS->exec("CREATE TRIGGER delete_artist AFTER DELETE ON artist FOR EACH ROW BEGIN DELETE FROM art WHERE media_id=old.idArtist AND media_type='artist'; END");
@@ -3509,7 +3509,7 @@ bool CMusicDatabase::UpdateOldVersion(int version)
if (version < 26)
{ // add art table
m_pDS->exec("CREATE TABLE art(art_id INTEGER PRIMARY KEY, media_id INTEGER, media_type TEXT, type TEXT, url TEXT)");
- m_pDS->exec("CREATE INDEX ix_art ON art(media_id, media_type, type)");
+ m_pDS->exec("CREATE INDEX ix_art ON art(media_id, media_type(20), type(20))");
m_pDS->exec("CREATE TRIGGER delete_song AFTER DELETE ON song FOR EACH ROW BEGIN DELETE FROM art WHERE media_id=old.idSong AND media_type='song'; END");
m_pDS->exec("CREATE TRIGGER delete_album AFTER DELETE ON album FOR EACH ROW BEGIN DELETE FROM art WHERE media_id=old.idAlbum AND media_type='album'; END");
m_pDS->exec("CREATE TRIGGER delete_artist AFTER DELETE ON artist FOR EACH ROW BEGIN DELETE FROM art WHERE media_id=old.idArtist AND media_type='artist'; END");

0 comments on commit ae6508e

Please sign in to comment.
Something went wrong with that request. Please try again.