Merge remote-tracking branch 'origin/master' into yellowalert

Conflicts:
	data/migrations/versions/82297d834ad_add_us_west_location.py
	test/data/test.db
This commit is contained in:
Jake Moshenko 2014-09-05 11:30:30 -04:00
commit 64480fd4ed
81 changed files with 1550 additions and 822 deletions

View file

@ -1,50 +1,39 @@
"""add new notification kinds
Revision ID: 4a0c94399f38
Revises: 82297d834ad
Revises: 1594a74a74ca
Create Date: 2014-08-28 16:17:01.898269
"""
# revision identifiers, used by Alembic.
revision = '4a0c94399f38'
down_revision = '82297d834ad'
down_revision = '1594a74a74ca'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
from data.model.sqlalchemybridge import gen_sqlalchemy_metadata
from data.database import all_models
def upgrade():
schema = gen_sqlalchemy_metadata(all_models)
op.bulk_insert(schema.tables['externalnotificationmethod'],
def upgrade(tables):
op.bulk_insert(tables.externalnotificationmethod,
[
{'id':4, 'name':'flowdock'},
{'id':5, 'name':'hipchat'},
{'id':6, 'name':'slack'},
])
def downgrade():
schema = gen_sqlalchemy_metadata(all_models)
externalnotificationmethod = schema.tables['externalnotificationmethod']
def downgrade(tables):
op.execute(
(externalnotificationmethod.delete()
.where(externalnotificationmethod.c.name == op.inline_literal('flowdock')))
(tables.externalnotificationmethod.delete()
.where(tables.externalnotificationmethod.c.name == op.inline_literal('flowdock')))
)
op.execute(
(externalnotificationmethod.delete()
.where(externalnotificationmethod.c.name == op.inline_literal('hipchat')))
(tables.externalnotificationmethod.delete()
.where(tables.externalnotificationmethod.c.name == op.inline_literal('hipchat')))
)
op.execute(
(externalnotificationmethod.delete()
.where(externalnotificationmethod.c.name == op.inline_literal('slack')))
(tables.externalnotificationmethod.delete()
.where(tables.externalnotificationmethod.c.name == op.inline_literal('slack')))
)