omab / python-social-auth

Social auth made simple
http://psa.matiasaguirre.net
BSD 3-Clause "New" or "Revised" License
2.83k stars 1.09k forks source link

Model issue when migrating from django-social-auth to python-social-auth #955

Closed JoeJasinski closed 7 years ago

JoeJasinski commented 8 years ago

I'm running django 1.8 and am trying to migrate from django-social-auth to python-social-auth. I'm using the newest released version of django-social-auth (0.7.28) and I'm trying to install the latest version python-social-auth.

I've followed the directions in the porting guide in the docs. However, I noticed that the the model state of the django-social-auth 0.7.28 does not match the initial migration of the python-social-auth migration. For example, the python-social-auth default module has models and fields in it in that are not in the state of my database from django-social-auth.

I'm wondering what the model upgrade path is between django-social-auth and python-social-auth? If I drop and recreate the social auth tables, will that irreversibly destroy the users and their social account, or will the same association get recreated next time they login in?

Here is the original repo with django-social-auth: https://github.com/chicagopython/chipy.org/blob/master/requirements.txt#L17

Here is the branch that I'm trying to upgrade to python-social-auth: https://github.com/JoeJasinski/chipy.org/blob/feature/cleanup-and-updates-2/requirements.txt

This is my current model state:

chipy_org=# \d social_auth_association
                                   Table "public.social_auth_association"
   Column   |          Type          |                              Modifiers                               
------------+------------------------+----------------------------------------------------------------------
 id         | integer                | not null default nextval('social_auth_association_id_seq'::regclass)
 server_url | character varying(255) | not null
 handle     | character varying(255) | not null
 secret     | character varying(255) | not null
 issued     | integer                | not null
 lifetime   | integer                | not null
 assoc_type | character varying(64)  | not null
Indexes:
    "social_auth_association_pkey" PRIMARY KEY, btree (id)

chipy_org=# \d social_auth_nonce;
                                   Table "public.social_auth_nonce"
   Column   |          Type          |                           Modifiers                            
------------+------------------------+----------------------------------------------------------------
 id         | integer                | not null default nextval('social_auth_nonce_id_seq'::regclass)
 server_url | character varying(255) | not null
 timestamp  | integer                | not null
 salt       | character varying(40)  | not null
Indexes:
    "social_auth_nonce_pkey" PRIMARY KEY, btree (id)

chipy_org=# \d social_auth_usersocialauth;
                                   Table "public.social_auth_usersocialauth"
   Column   |          Type          |                                Modifiers                                
------------+------------------------+-------------------------------------------------------------------------
 id         | integer                | not null default nextval('social_auth_usersocialauth_id_seq'::regclass)
 user_id    | integer                | not null
 provider   | character varying(32)  | not null
 uid        | character varying(255) | not null
 extra_data | text                   | not null
Indexes:
    "social_auth_usersocialauth_pkey" PRIMARY KEY, btree (id)
    "social_auth_usersocialauth_provider_uid_key" UNIQUE CONSTRAINT, btree (provider, uid)
    "social_auth_usersocialauth_user_id" btree (user_id)
Foreign-key constraints:
    "social_auth_usersocial_user_id_193b2d80880502b2_fk_auth_user_id" FOREIGN KEY (user_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED

chipy_org=# \d social_auth_usersocialauth_user_id 
Index "public.social_auth_usersocialauth_user_id"
 Column  |  Type   | Definition 
---------+---------+------------
 user_id | integer | user_id
btree, for table "public.social_auth_usersocialauth"