# Path: kittystore/storm/schema/utils.py
# def get_db_type(store):
#     database = store.get_database()
#     return database.__class__.__module__.split(".")[-1]


from .utils import get_db_type
        'CREATE INDEX `ix_sender_user_id` ON `sender` (user_id);',
        'CREATE INDEX `ix_email_list_name_thread_id` ON `email` (list_name, thread_id);',
        'CREATE INDEX `ix_attachment_list_name_message_id` ON `attachment` (list_name, message_id);',
        ],
    }

SQL_step_2 = {
    "sqlite": [
        'DROP INDEX "ix_email_user_id"',
        # No 'ALTER TABLE DROP COLUMN' or 'ALTER TABLE ADD constraint' in SQLite
        ],
    "postgres": [
        'DROP INDEX "ix_email_user_id"',
        'ALTER TABLE "email" DROP COLUMN "sender_name"',
        'ALTER TABLE "email" DROP COLUMN "user_id"',
        'ALTER TABLE "email" ADD FOREIGN KEY (sender_email) REFERENCES sender(email)',
        ],
    "mysql": [
        'DROP INDEX `ix_email_user_id`',
        'ALTER TABLE `email` DROP COLUMN `sender_name`',
        'ALTER TABLE `email` DROP COLUMN `user_id`',
        'ALTER TABLE `email` ADD FOREIGN KEY (sender_email) REFERENCES sender(email)',
        ],
    }


def apply(store):
    """
    Remove the database-based cache.
    """

# Path: kittystore/storm/schema/utils.py
# def get_db_type(store):
#     database = store.get_database()
#     return database.__class__.__module__.split(".")[-1]


# Path: kittystore/storm/schema/patch_17.py
from .utils import get_db_type

        'CREATE INDEX `ix_sender_user_id` ON `sender` (user_id);',
        'CREATE INDEX `ix_email_list_name_thread_id` ON `email` (list_name, thread_id);',
        'CREATE INDEX `ix_attachment_list_name_message_id` ON `attachment` (list_name, message_id);',
        ],
    }

SQL_step_2 = {
    "sqlite": [
        'DROP INDEX "ix_email_user_id"',
        # No 'ALTER TABLE DROP COLUMN' or 'ALTER TABLE ADD constraint' in SQLite
        ],
    "postgres": [
        'DROP INDEX "ix_email_user_id"',
        'ALTER TABLE "email" DROP COLUMN "sender_name"',
        'ALTER TABLE "email" DROP COLUMN "user_id"',
        'ALTER TABLE "email" ADD FOREIGN KEY (sender_email) REFERENCES sender(email)',
        ],
    "mysql": [
        'DROP INDEX `ix_email_user_id`',
        'ALTER TABLE `email` DROP COLUMN `sender_name`',
        'ALTER TABLE `email` DROP COLUMN `user_id`',
        'ALTER TABLE `email` ADD FOREIGN KEY (sender_email) REFERENCES sender(email)',
        ],
    }


def apply(store):
    """
    Remove the database-based cache.
    """

    dbtype = get_db_type(store)