Opened 6 years ago

Last modified 11 months ago

#29898 new Cleanup/optimization

Adapt schema editors to operate from model states instead of fake rendered models

Reported by: Simon Charette Owned by:
Component: Migrations Version: dev
Severity: Normal Keywords:
Cc: Markus Holtermann, Simon Charette, Adam Johnson, David Wobrock Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no
Pull Requests:14587 merged, 14760 merged, 14797 merged, 14781 merged, 14436 merged, 14551 merged, 14206 unmerged

Description

Rendering models meant to be passed to the schema editor during the migrate phase is the main source of slowdown during the migrate phase of a project.

Adapting schema editors to be able to perform the same operations with model states would be way more efficient as model rendering could always be delayed until it's a necessity such during the application of RunPython operations.

Ref #22608.

Initial work by Markus Holtermann here https://github.com/django/django/compare/master...MarkusH:schemaeditor-modelstate

According to the ticket's flags, the next step(s) to move this issue forward are:

  • To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is: [https://github.com/django/django/pull/#### PR].

Change History (13)

comment:1 by Adam Johnson, 5 years ago

Cc: Adam Johnson added

comment:2 by Sanskar Jaiswal, 5 years ago

Hello everyone. This is the proposal that I submitted for GSoC, which unfortunately wasn't accepted. If it's fine, I would still like to work on this ticket. It would be amazing if I could get the above mentioned proposal reviewed and was given feedback, so that I know what to change and how to proceed.

Cheers

comment:3 by Manav Agarwal, 4 years ago

Owner: changed from nobody to Manav Agarwal
Status: newassigned

comment:4 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

In d718d990:

Refs #29898 -- Moved django.db.migrations.operations.utils to django.db.migrations.utils.

comment:5 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

In 503ee414:

Refs #29898 -- Moved state_forwards()'s logic from migration operations to ProjectState.

Thanks Simon Charette and Markus Holtermann for reviews.

comment:6 by David Wobrock, 4 years ago

Cc: David Wobrock added

comment:7 by Carlton Gibson <carlton@…>, 4 years ago

In 54a30a7:

Refs #29898 -- Changed ProjectState.real_apps to set.

comment:8 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

In 3e6a3e88:

Refs #29898 -- Refactored out ProjectState.resolve_model_relations()/resolve_model_field_relations() hooks.

comment:9 by Mariusz Felisiak, 3 years ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:10 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

In 196a99da:

Refs #29898 -- Made ProjectState encapsulate alterations in relations registry.

Thanks Simon Charette and Chris Jerdonek for reviews.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@…>

comment:11 by Mariusz Felisiak, 3 years ago

Has patch: unset
Triage Stage: Ready for checkinAccepted

comment:12 by GitHub <noreply@…>, 3 years ago

In fa1d7ba5:

Refs #29898 -- Changed fields in ProjectState's relation registry to dict.

comment:13 by Mariusz Felisiak, 11 months ago

Owner: Manav Agarwal removed
Status: assignednew
Note: See TracTickets for help on using tickets.
Back to Top