Skip to content

Commit

Permalink
[#1170] Updated user migration
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperBrandt committed Feb 23, 2015
1 parent 2125786 commit e90ff8b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions akvo/rsr/migrations/0066_auto__add_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ def forwards(self, orm):
))
db.send_create_signal('rsr', ['User'])

try:
# Removing M2M table for field organisation on 'User'
db.delete_table(db.shorten_name(u'rsr_user_organisations'))
except:
pass

# Adding M2M table for field organisation on 'User'
m2m_table_name = db.shorten_name(u'rsr_user_organisations')
db.create_table(m2m_table_name, (
Expand All @@ -40,6 +46,12 @@ def forwards(self, orm):
))
db.create_unique(m2m_table_name, ['user_id', 'organisation_id'])

try:
# Removing M2M table for field organisation on 'User'
db.delete_table(db.shorten_name(u'rsr_user_groups'))
except:
pass

# Adding M2M table for field groups on 'User'
m2m_table_name = db.shorten_name(u'rsr_user_groups')
db.create_table(m2m_table_name, (
Expand All @@ -49,6 +61,12 @@ def forwards(self, orm):
))
db.create_unique(m2m_table_name, ['user_id', 'group_id'])

try:
# Removing M2M table for field organisation on 'User'
db.delete_table(db.shorten_name(u'rsr_user_user_permissions'))
except:
pass

# Adding M2M table for field user_permissions on 'User'
m2m_table_name = db.shorten_name(u'rsr_user_user_permissions')
db.create_table(m2m_table_name, (
Expand Down

0 comments on commit e90ff8b

Please sign in to comment.