Hacker News new | past | comments | ask | show | jobs | submit login

I should write it up as a blog post. Basically:

1) Create the new User model, and create a schema migration for it.

2) Create a data migration to copy every piece of data you have in your users and profiles over to the new User model.

3) Add ForeignKeys to all your models that reference either the old User model or the Profile.

4) Add a data migration to copy every reference to the old User/Profile from every other model to the new FKs, to point to the corresponding NewUser model.

5) Remove the old FKs with a schema migration.

6) Rename all the new FKs to the old names, create a schema migration, go into it and turn all the delete/creates into column updates.

7) Revert your code to your last commit because you noticed you screwed something up and you can't reverse it now.

8) Done.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: