summaryrefslogtreecommitdiffstats
path: root/kittystore/storm/schema/patch_15.py
blob: c9d3f6b7708c2383a4fd889a50f3265acef83a60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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()