-
Notifications
You must be signed in to change notification settings - Fork 824
Description
Hey guys,
So I'm swapping the OAuth models on an application that is already live. All sorts of nice things there, but I'm getting around. I have however 2 comments
-
I haven't found much documentation on this subject. I think it's important to mention that since multiple models are linked together, it's a good idea to swap them all if you start to swap one. I started with just changing
AccessTokenbut it created all sorts of complexities -
More importantly, I think for a brand new application, it's not possible to swap the models anymore. Indeed, with the new 1.1 datamodel,
AccessTokenreferencesRefreshTokenthroughsource_refresh_tokenandRefreshTokenreferencesAcessTokenthroughaccess_token. In your app this is ok because this is done over a few migration that creates the 2 tables with only one FK, and then add the second FK afterwards.
But on new applications that try to swap the model, it will try to create the full table in one go and fail. I had to manually hack the migration and split the table creation manually.
--> I don't have a great solution for you, but tables that cross references themselves cyclically is bad news I guess