Code of Conduct
Feature Description
A system whereby a package could add additional code to be run while squashing migrations.
Problem
Two packages I've been involved with have a way to generate migrations which it rewrites to contain specific data. Currently squashing migrations would involve a manual process of dealing with these generated migrations, but that could be automated. I created an overriding squashmigrations in the one package, and then thought of how I would do that in the second package, and then realized there is no good way to do both. It is fine if there is only one, but there is no way for the two projects to do both of their code when squashing, as they each inherit from the original squash migrations command and the last one in the app list would win.
Request or proposal
proposal
Additional Details
I think a discussion would be needed to figure out how to create this system, since there are probably many different ways to do it. I am fine working on it, as I could test it with the two packages, but I think the how should be decided by the community, not just me.
Implementation Suggestions
In the case of the one package it deals with creating migrations for workflow. The developer makes changes locally, then runs a management command to create a migration with the data needed to be deployed to the site. Updating the site then runs the migration which makes those changes. Additional changes need the management command run again, which creates a new migration.
Squashing these migrations would be as simple as creating a new migration and copying and combining data from each of the migrations of this type into the new migration. So the code would create a second squashed migration file. Since this can happen independently of the existing squash migrations code, it can run after the current code.
The other package can create multiple migrations based on app and model, so squashing it may require multiple new squashed migrations to be created, but it as well could run after the current code.
Would running additional code after the squashed migration file is created be sufficient for everyone?
Code of Conduct
Feature Description
A system whereby a package could add additional code to be run while squashing migrations.
Problem
Two packages I've been involved with have a way to generate migrations which it rewrites to contain specific data. Currently squashing migrations would involve a manual process of dealing with these generated migrations, but that could be automated. I created an overriding squashmigrations in the one package, and then thought of how I would do that in the second package, and then realized there is no good way to do both. It is fine if there is only one, but there is no way for the two projects to do both of their code when squashing, as they each inherit from the original squash migrations command and the last one in the app list would win.
Request or proposal
proposal
Additional Details
I think a discussion would be needed to figure out how to create this system, since there are probably many different ways to do it. I am fine working on it, as I could test it with the two packages, but I think the how should be decided by the community, not just me.
Implementation Suggestions
In the case of the one package it deals with creating migrations for workflow. The developer makes changes locally, then runs a management command to create a migration with the data needed to be deployed to the site. Updating the site then runs the migration which makes those changes. Additional changes need the management command run again, which creates a new migration.
Squashing these migrations would be as simple as creating a new migration and copying and combining data from each of the migrations of this type into the new migration. So the code would create a second squashed migration file. Since this can happen independently of the existing squash migrations code, it can run after the current code.
The other package can create multiple migrations based on app and model, so squashing it may require multiple new squashed migrations to be created, but it as well could run after the current code.
Would running additional code after the squashed migration file is created be sufficient for everyone?