Debian Codegraph @

taskflow/persistence/backends/sqlalchemy/alembic/versions/14b227d79a87_add_intention_column.py

raw
1 # Copyright (C) 2012-2013 Yahoo! Inc. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
13 # under the License.
14
15 # revision identifiers, used by Alembic.
16 revision = '14b227d79a87'
17 down_revision = '84d6e888850'
18
19 from alembic import op
20 import sqlalchemy as sa
21
22 from taskflow import states
23
24
25 def upgrade():
26 bind = op.get_bind()
27 intention_type = sa.Enum(*states.INTENTIONS, name='intention_type')
28 column = sa.Column('intention', intention_type,
29 server_default=states.EXECUTE)
30 impl = intention_type.dialect_impl(bind.dialect)
31 impl.create(bind, checkfirst=True)
32 op.add_column('taskdetails', column)
33
34
35 def downgrade():
36 op.drop_column('taskdetails', 'intention')