Create index

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>
This commit is contained in:
Drapersniper
2019-12-19 18:37:16 +00:00
parent 050655f753
commit e39b18f751

View File

@@ -171,6 +171,9 @@ VALUES
playlist_url = excluded.playlist_url, playlist_url = excluded.playlist_url,
tracks = excluded.tracks; tracks = excluded.tracks;
""" """
_CREATE_INDEX = """
CREATE INDEX IF NOT EXISTS name_index ON playlists (scope_type, playlist_id, playlist_name, scope_id);
"""
@dataclass @dataclass
@@ -205,6 +208,7 @@ class Database:
self.cursor.execute(_PRAGMA_UPDATE_journal_mode) self.cursor.execute(_PRAGMA_UPDATE_journal_mode)
self.cursor.execute(_PRAGMA_UPDATE_read_uncommitted) self.cursor.execute(_PRAGMA_UPDATE_read_uncommitted)
self.cursor.execute(_CREATE_TABLE) self.cursor.execute(_CREATE_TABLE)
self.cursor.execute(_CREATE_INDEX)
def close(self): def close(self):
self._database.close() self._database.close()