diff --git a/storyboard/db/api/subscriptions.py b/storyboard/db/api/subscriptions.py index 99d0c82b..5da42ff4 100644 --- a/storyboard/db/api/subscriptions.py +++ b/storyboard/db/api/subscriptions.py @@ -26,7 +26,8 @@ SUPPORTED_TYPES = { 'project': models.Project, 'project_group': models.ProjectGroup, 'story': models.Story, - 'task': models.Task + 'task': models.Task, + 'worklist': models.Worklist } diff --git a/storyboard/db/migration/alembic_migrations/versions/058_allow_subscription_to_worklists.py b/storyboard/db/migration/alembic_migrations/versions/058_allow_subscription_to_worklists.py new file mode 100644 index 00000000..9a3c9040 --- /dev/null +++ b/storyboard/db/migration/alembic_migrations/versions/058_allow_subscription_to_worklists.py @@ -0,0 +1,46 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# + +"""Allow subscription to worklists + +Revision ID: 058 +Revises: 057 +Create Date: 2016-06-01 13:28:19.033906 + +""" + +# revision identifiers, used by Alembic. +revision = '058' +down_revision = '057' + + +from alembic import op +import sqlalchemy as sa + +old_type_enum = sa.Enum('task', 'story', 'project', 'project_group') +new_type_enum = sa.Enum( + 'task', 'story', 'project', 'project_group', 'worklist') + + +def upgrade(active_plugins=None, options=None): + op.alter_column('subscriptions', + 'target_type', + existing_type=old_type_enum, + type_=new_type_enum) + + +def downgrade(active_plugins=None, options=None): + op.alter_column('subscriptions', + 'target_type', + existing_type=new_type_enum, + type_=old_type_enum) diff --git a/storyboard/db/models.py b/storyboard/db/models.py index bc2d2e0a..97d84e2a 100644 --- a/storyboard/db/models.py +++ b/storyboard/db/models.py @@ -511,7 +511,8 @@ class Comment(FullText, ModelBuilder, Base): # Subscription and notifications class Subscription(ModelBuilder, Base): - _SUBSCRIPTION_TARGETS = ('task', 'story', 'project', 'project_group') + _SUBSCRIPTION_TARGETS = ('task', 'story', 'project', 'project_group', + 'worklist') user_id = Column(Integer, ForeignKey('users.id')) target_type = Column(Enum(*_SUBSCRIPTION_TARGETS))