This repository has been archived by the owner on Jan 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate Mozilla Locamotion ExternalAccounts to new identifier.
- Loading branch information
Showing
1 changed file
with
190 additions
and
0 deletions.
There are no files selected for viewing
190 changes: 190 additions & 0 deletions
190
mozillians/users/migrations/0074_fix_locomotion_type.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
# -*- coding: utf-8 -*- | ||
from south.utils import datetime_utils as datetime | ||
from south.db import db | ||
from south.v2 import DataMigration | ||
from django.db import models | ||
|
||
class Migration(DataMigration): | ||
|
||
def forwards(self, orm): | ||
"""Fixes regression introduced in faf9ab63. Migrates DB entries to new account type.""" | ||
ExternalAccount = orm['users.ExternalAccount'] | ||
old_account_type = 'MOZILLALOCOMOTION' | ||
new_account_type = 'MOZILLALOCAMOTION' | ||
|
||
for account in ExternalAccount.objects.filter(type=old_account_type): | ||
account.type = new_account_type | ||
account.save() | ||
|
||
def backwards(self, orm): | ||
pass | ||
|
||
models = { | ||
u'auth.group': { | ||
'Meta': {'object_name': 'Group'}, | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), | ||
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) | ||
}, | ||
u'auth.permission': { | ||
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, | ||
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) | ||
}, | ||
u'auth.user': { | ||
'Meta': {'object_name': 'User'}, | ||
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), | ||
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), | ||
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), | ||
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | ||
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), | ||
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), | ||
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), | ||
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}), | ||
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) | ||
}, | ||
u'contenttypes.contenttype': { | ||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, | ||
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) | ||
}, | ||
u'geo.city': { | ||
'Meta': {'unique_together': "(('name', 'region', 'country'),)", 'object_name': 'City'}, | ||
'country': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['geo.Country']"}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'lat': ('django.db.models.fields.FloatField', [], {}), | ||
'lng': ('django.db.models.fields.FloatField', [], {}), | ||
'mapbox_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}), | ||
'name': ('django.db.models.fields.CharField', [], {'max_length': '120'}), | ||
'region': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['geo.Region']", 'null': 'True', 'blank': 'True'}) | ||
}, | ||
u'geo.country': { | ||
'Meta': {'object_name': 'Country'}, | ||
'code': ('django.db.models.fields.CharField', [], {'max_length': '2'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'mapbox_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}), | ||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '120'}) | ||
}, | ||
u'geo.region': { | ||
'Meta': {'unique_together': "(('name', 'country'),)", 'object_name': 'Region'}, | ||
'country': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['geo.Country']"}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'mapbox_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}), | ||
'name': ('django.db.models.fields.CharField', [], {'max_length': '120'}) | ||
}, | ||
u'groups.group': { | ||
'Meta': {'ordering': "['name']", 'object_name': 'Group'}, | ||
'accepting_new_members': ('django.db.models.fields.CharField', [], {'default': "'yes'", 'max_length': '10'}), | ||
'curator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'groups_curated'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': u"orm['users.UserProfile']"}), | ||
'description': ('django.db.models.fields.TextField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}), | ||
'functional_area': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'irc_channel': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '63', 'blank': 'True'}), | ||
'max_reminder': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | ||
'members_can_leave': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | ||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}), | ||
'new_member_criteria': ('django.db.models.fields.TextField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}), | ||
'url': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'blank': 'True'}), | ||
'visible': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | ||
'website': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}), | ||
'wiki': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}) | ||
}, | ||
u'groups.groupmembership': { | ||
'Meta': {'unique_together': "(('userprofile', 'group'),)", 'object_name': 'GroupMembership'}, | ||
'date_joined': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), | ||
'group': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['groups.Group']"}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'status': ('django.db.models.fields.CharField', [], {'max_length': '10'}), | ||
'userprofile': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['users.UserProfile']"}) | ||
}, | ||
u'groups.skill': { | ||
'Meta': {'ordering': "['name']", 'object_name': 'Skill'}, | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}), | ||
'url': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'blank': 'True'}) | ||
}, | ||
u'users.externalaccount': { | ||
'Meta': {'ordering': "['type']", 'unique_together': "(('identifier', 'type', 'user'),)", 'object_name': 'ExternalAccount'}, | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
'privacy': ('django.db.models.fields.PositiveIntegerField', [], {'default': '3'}), | ||
'type': ('django.db.models.fields.CharField', [], {'max_length': '30'}), | ||
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['users.UserProfile']"}) | ||
}, | ||
u'users.language': { | ||
'Meta': {'ordering': "['code']", 'unique_together': "(('code', 'userprofile'),)", 'object_name': 'Language'}, | ||
'code': ('django.db.models.fields.CharField', [], {'max_length': '63'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'userprofile': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['users.UserProfile']"}) | ||
}, | ||
u'users.usernameblacklist': { | ||
'Meta': {'ordering': "['value']", 'object_name': 'UsernameBlacklist'}, | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'is_regex': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'value': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) | ||
}, | ||
u'users.userprofile': { | ||
'Meta': {'ordering': "['full_name']", 'object_name': 'UserProfile', 'db_table': "'profile'"}, | ||
'allows_community_sites': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | ||
'allows_mozilla_sites': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | ||
'basket_token': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024', 'blank': 'True'}), | ||
'bio': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), | ||
'can_vouch': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'date_mozillian': ('django.db.models.fields.DateField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}), | ||
'full_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}), | ||
'geo_city': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['geo.City']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}), | ||
'geo_country': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['geo.Country']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}), | ||
'geo_region': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['geo.Region']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}), | ||
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'members'", 'blank': 'True', 'through': u"orm['groups.GroupMembership']", 'to': u"orm['groups.Group']"}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'ircname': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '63', 'blank': 'True'}), | ||
'is_vouched': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'last_updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'auto_now': 'True', 'blank': 'True'}), | ||
'lat': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), | ||
'lng': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), | ||
'photo': (u'sorl.thumbnail.fields.ImageField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}), | ||
'privacy_bio': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), | ||
'privacy_date_mozillian': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), | ||
'privacy_email': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), | ||
'privacy_full_name': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), | ||
'privacy_geo_city': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), | ||
'privacy_geo_country': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), | ||
'privacy_geo_region': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), | ||
'privacy_groups': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), | ||
'privacy_ircname': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), | ||
'privacy_languages': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), | ||
'privacy_photo': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), | ||
'privacy_skills': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), | ||
'privacy_story_link': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), | ||
'privacy_timezone': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), | ||
'privacy_title': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), | ||
'privacy_tshirt': ('mozillians.users.models.PrivacyField', [], {'default': '1'}), | ||
'referral_source': ('django.db.models.fields.CharField', [], {'default': "'direct'", 'max_length': '32'}), | ||
'skills': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'members'", 'blank': 'True', 'to': u"orm['groups.Skill']"}), | ||
'story_link': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '1024', 'blank': 'True'}), | ||
'timezone': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}), | ||
'title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '70', 'blank': 'True'}), | ||
'tshirt': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}), | ||
'user': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['auth.User']", 'unique': 'True'}) | ||
}, | ||
u'users.vouch': { | ||
'Meta': {'ordering': "['-date']", 'unique_together': "(('vouchee', 'voucher'),)", 'object_name': 'Vouch'}, | ||
'autovouch': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), | ||
'description': ('django.db.models.fields.TextField', [], {'default': "''", 'max_length': '500'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'vouchee': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'vouches_received'", 'to': u"orm['users.UserProfile']"}), | ||
'voucher': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'vouches_made'", 'on_delete': 'models.SET_NULL', 'default': 'None', 'to': u"orm['users.UserProfile']", 'blank': 'True', 'null': 'True'}) | ||
} | ||
} | ||
|
||
complete_apps = ['users'] | ||
symmetrical = True |