summaryrefslogtreecommitdiffstats
path: root/kittystore/storm/schema/patch_15.py
diff options
context:
space:
mode:
Diffstat (limited to 'kittystore/storm/schema/patch_15.py')
-rw-r--r--kittystore/storm/schema/patch_15.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/kittystore/storm/schema/patch_15.py b/kittystore/storm/schema/patch_15.py
new file mode 100644
index 0000000..c9d3f6b
--- /dev/null
+++ b/kittystore/storm/schema/patch_15.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import absolute_import
+
+from .utils import get_db_type
+
+
+SQL = {
+ "sqlite": [
+ 'CREATE INDEX "ix_thread_subject" ON "thread" (subject);',
+ ],
+ "postgres": [
+ 'CREATE INDEX "ix_thread_subject" ON "thread" (subject);',
+ ],
+ "mysql": [
+ 'CREATE INDEX `ix_thread_subject` ON `thread` (subject);',
+ ],
+ }
+
+
+def apply(store):
+ """Add indexes on thread.subject"""
+ dbtype = get_db_type(store)
+ for statement in SQL[dbtype]:
+ store.execute(statement)
+ store.commit()