Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Social Django Related Model Migration Error #26

Closed
Pal0r opened this issue Jan 28, 2017 · 3 comments
Closed

Social Django Related Model Migration Error #26

Pal0r opened this issue Jan 28, 2017 · 3 comments

Comments

@Pal0r
Copy link

Pal0r commented Jan 28, 2017

Im migrating a django 1.10 app from PSA==0.3.5 to social-auth-app-django==1.0.0 +
social-auth-core==1.0.1 and am running into some migration issues on a related table.

While applying this migration:

class Migration(migrations.Migration):

    dependencies = [
        ('social_django', '0006_partial'),
        ('accounts', '0041_merge_20170105_1912'),
    ]

    operations = [
        migrations.CreateModel(
            name='SocialAuthExpiration',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('expires_at', models.DateTimeField()),
                ('refresh_failed', models.NullBooleanField()),
                ('social_auth', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='token_expiration', to='social_django.UserSocialAuth')),
            ],
            managers=[
                ('expirations', django.db.models.manager.Manager()),
            ],
        ),
    ]

For this model:

class SocialAuthExpiration(models.Model):
    social_auth = models.OneToOneField(
        UserSocialAuth,
        on_delete=models.CASCADE,
        related_name='token_expiration'
    )
    ...

Im encountering this error:
ValueError: Related model u'social_django.UserSocialAuth' cannot be resolved

Social Django is installed. Plus I'm able to create new UserSocialAuth objects. I've attempted changing the to field to 'social.UserSocialAuth' as well, to no avail.

INSTALLED_APPS = [
    ...
    # Social Auth
    'social_django',
    # Local dev utils/runserver
    'django_extensions',
    # Hueya Apps
    'accounts', <<< New model and migration live here
    ...
]

django_migrations table relevant rows:

124 | social_auth   | 0005_auto_20160727_2333                  | 2016-12-21 15:40:36.562573+00
 125 | social_auth   | 0001_initial                                            | 2016-12-21 15:40:36.567864+00
 126 | social_auth   | 0003_alter_email_max_length              | 2016-12-21 15:40:36.571+00
 127 | social_auth   | 0004_auto_20160423_0400                | 2016-12-21 15:40:36.57382+00
 128 | social_auth   | 0002_add_related_name                      | 2016-12-21 15:40:36.576405+00
 146 | social_django | 0006_partial                                        | 2017-01-28 19:05:27.811943+00

Im hoping someone has had some experience with this and might be able to point me in the right direction. Thanks.

@omab
Copy link
Contributor

omab commented Jan 29, 2017

I've just released 1.0.1, could you give it a try?

@Pal0r
Copy link
Author

Pal0r commented Jan 29, 2017

Thank you for the response and quick update. I suspected this had to do with my migrations getting out of sync. So I went nuclear & blew out that migration history and dropped those tables.

I had no issue applying the 1.0.1 social-auth-django migrations. Nor did anything go awry with the loaddata command. Subsequent migrations with relations to social_django are also working as intended.

Problem in Chair; Not in Computer situation.

@omab omab closed this as completed Jan 29, 2017
@omab
Copy link
Contributor

omab commented Jan 29, 2017

Thanks for the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants