'This migration has been customized to support upgrades from Cloudera
Enterprise 3.5, as well as Hue 1.2'

def forwards(self, orm):

    if ('userman_ldapgroup' in connection.introspection.table_names()):
        db.rename_table('userman_ldapgroup', 'useradmin_ldapgroup')
        db.delete_column('useradmin_ldapgroup', 'hidden')
    else:
        db.create_table('useradmin_ldapgroup', (('group', self.gf('django.db.models.fields.related.ForeignKey')(related_name='group', to=orm['auth.Group'])), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True))))
        db.send_create_signal('useradmin', ['LdapGroup'])
    try:
        db.add_column('useradmin_userprofile', 'creation_method', self.gf('django.db.models.fields.CharField')(max_length=64, default=str(UserProfile.CreationMethod.HUE)), keep_default=False)
    except Exception:
        pass
    for user in User.objects.all():
        try:
            orm.UserProfile.objects.get(user=user)
        except orm.UserProfile.DoesNotExist:
            create_profile_for_user(user)
