Add migration for new notification kinds
This commit is contained in:
parent
7014e0b662
commit
9142ff69a3
2 changed files with 51 additions and 1 deletions
|
@ -0,0 +1,50 @@
|
||||||
|
"""add new notification kinds
|
||||||
|
|
||||||
|
Revision ID: 4a0c94399f38
|
||||||
|
Revises: 82297d834ad
|
||||||
|
Create Date: 2014-08-28 16:17:01.898269
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '4a0c94399f38'
|
||||||
|
down_revision = '82297d834ad'
|
||||||
|
|
||||||
|
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'],
|
||||||
|
[
|
||||||
|
{'id':4, 'name':'flowdock'},
|
||||||
|
{'id':5, 'name':'hipchat'},
|
||||||
|
{'id':6, 'name':'slack'},
|
||||||
|
])
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
schema = gen_sqlalchemy_metadata(all_models)
|
||||||
|
externalnotificationmethod = schema.tables['externalnotificationmethod']
|
||||||
|
|
||||||
|
op.execute(
|
||||||
|
(externalnotificationmethod.delete()
|
||||||
|
.where(externalnotificationmethod.c.name == op.inline_literal('flowdock')))
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
op.execute(
|
||||||
|
(externalnotificationmethod.delete()
|
||||||
|
.where(externalnotificationmethod.c.name == op.inline_literal('hipchat')))
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
op.execute(
|
||||||
|
(externalnotificationmethod.delete()
|
||||||
|
.where(externalnotificationmethod.c.name == op.inline_literal('slack')))
|
||||||
|
|
||||||
|
)
|
|
@ -28,9 +28,9 @@ def upgrade():
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
schema = gen_sqlalchemy_metadata(all_models)
|
schema = gen_sqlalchemy_metadata(all_models)
|
||||||
|
imagestoragelocation = schema.tables['imagestoragelocation']
|
||||||
|
|
||||||
op.execute(
|
op.execute(
|
||||||
(imagestoragelocation.delete()
|
(imagestoragelocation.delete()
|
||||||
.where(imagestoragelocation.c.name == op.inline_literal('s3_us_west_1')))
|
.where(imagestoragelocation.c.name == op.inline_literal('s3_us_west_1')))
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
Reference in a new issue