blob: dc41cbe3faba89645e5d8e98984031a38410c72a (
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
27
28
29
|
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from . import get_db_type
SQL = {
"sqlite": [
'ALTER TABLE "email" ADD COLUMN user_id VARCHAR(255);',
'CREATE INDEX "ix_email_user_id" ON "email" (user_id);',
],
"postgres": [
'ALTER TABLE "email" ADD COLUMN user_id VARCHAR(255);',
'CREATE INDEX "ix_email_user_id" ON "email" USING btree (user_id);',
],
"mysql": [
'ALTER TABLE `email` ADD COLUMN user_id VARCHAR(255);',
'CREATE INDEX `ix_email_user_id` ON `email` (user_id(255));',
],
}
def apply(store):
"""Add the user_address table"""
dbtype = get_db_type(store)
for statement in SQL[dbtype]:
store.execute(statement)
store.commit()
|