-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Remote Repository and Remote Organization Normalization #7949
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
Conversation
I did some research and tests for the database constraint that we will need to deal with. The plan here will be:
PostgreSQL documentation: https://www.postgresql.org/docs/9.1/sql-altertable.html
As example in my local instance:
# Drop constraints from RemoteRepositoryRelation
ALTER TABLE oauth_remoterepositoryrelation DROP CONSTRAINT oauth_remotereposito_account_id_02d56944_fk_socialacc;
ALTER TABLE oauth_remoterepositoryrelation DROP CONSTRAINT oauth_remoterepositoryrelation_user_id_3c2baf85_fk_auth_user_id;
# Drop constraints from RemoteOrganizationRelation
ALTER TABLE oauth_remoteorganizationrelation DROP CONSTRAINT oauth_remoteorganiza_account_id_8dbef288_fk_socialacc;
ALTER TABLE oauth_remoteorganizationrelation DROP CONSTRAINT oauth_remoteorganiza_user_id_0603492b_fk_auth_user;
# Add constraints from RemoteRepositoryRelation
ALTER TABLE "oauth_remoterepositoryrelation" ADD CONSTRAINT "oauth_remoterepositoryrelation_user_id_3c2baf85_fk_auth_user_id" FOREIGN KEY ("user_id") REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "oauth_remoterepositoryrelation" ADD CONSTRAINT "oauth_remotereposito_account_id_02d56944_fk_socialacc" FOREIGN KEY ("account_id") REFERENCES "socialaccount_socialaccount" ("id") DEFERRABLE INITIALLY DEFERRED;
# Add constraints for RemoteOrganizationRelation
ALTER TABLE "oauth_remoteorganizationrelation" ADD CONSTRAINT "oauth_remoteorganiza_user_id_0603492b_fk_auth_user" FOREIGN KEY ("user_id") REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "oauth_remoteorganizationrelation" ADD CONSTRAINT "oauth_remoteorganiza_account_id_8dbef288_fk_socialacc" FOREIGN KEY ("account_id") REFERENCES "socialaccount_socialaccount" ("id") DEFERRABLE INITIALLY DEFERRED; First, try to
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good!
Just to mention that I linked docs from 9.1 and we are using v12. The documentation is a updated and better: https://www.postgresql.org/docs/12/sql-altertable.html
After reading the v12 docs it seems it's better to use
it seems we may need to lock the other tables? (Project and SocialAcctount) |
…remote-repository-normalization
…n and Use raw_id_fields in Admin
Remove duplicate results from RemoteOrganization API
Co-authored-by: Maksudul Haque <[email protected]>
…remote-repository-normalization
This PR is merged in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is ready to be merged and it will go out tomorrow in commercial.
This PR contains the full implementation for the Remote Repository and Remote Organization Normalization.
This PR creates separate database tables for the
RemoteRepository
andRemoteOrganization
with the new modeling.This also updates the codebase with the changes for the new modeling and adds a management command to re-sync all the remote repositories and remoter organizations.
The tasks done in this PR can be found here: https://github.com/orgs/readthedocs/projects/74#column-11164063
Closes #7572
Closes #7727