Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Commit

Permalink
migration for adding can_manage_optouts boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
smn committed Nov 12, 2013
1 parent b5ec968 commit 0cef350
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions go/vumitools/account/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,22 @@ def migrate_from_2(self, mdata):
mdata.set_value('$VERSION', 3)

return mdata

def migrate_from_3(self, mdata):
"""
Add the can_manage_optouts boolean and default it to ``False``
"""

# Copy stuff that hasn't changed between versions
mdata.copy_values(
'username', 'created_at', 'msisdn', 'confirm_start_conversation',
'tags', 'event_handler_config', 'routing_table')
mdata.copy_indexes('tagpools_bin', 'applications_bin')

# set the default `can_manage_optouts` value
mdata.set_value('can_manage_optouts', False)

# increment version counter
mdata.set_value('$VERSION', 4)

return mdata
2 changes: 1 addition & 1 deletion go/vumitools/account/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class UserAppPermission(Model):
class UserAccount(Model):
"""A user account."""

VERSION = 3
VERSION = 4
MIGRATOR = UserAccountMigrator

# key is uuid
Expand Down

0 comments on commit 0cef350

Please sign in to comment.