Open benjaminrigaud opened 1 year ago
@benjaminrigaud Thank you for your thoughts I will try to get deeper into it through the weekend
Hi,
If I implement a fix, would you have time to review it? :bow:
Ben
Hello @benjaminrigaud Please do so, thank you! Apologize that I didn't find time to write it I will review your code and merge
Hello,
I have run into the same issue while experimenting with django-db-views on my project.
@benjaminrigaud you said
As a workaround, I have implemented a fixture to be able to apply any migration on the fly.
would it be possible for you to share the code of your fixture ?
Thanks, Jonathan
would it be possible for you to share the code of your fixture ?
Sorry @lajus, I can't share that code from a private Repo.
Some details:
__import__
to import the migration moduleMigration
class from this modulemigration.apply(...)
When running
pytest --no-migrations
, Models are synced to their corresponding tables as-is: no migrations are executed.django-db-views
doesn't support this mode: the views are not created and the tests fail.As a workaround, I have implemented a fixture to be able to apply any migration on the fly.
A proper implementation in
django-db-views
could be to uncouple the SQL creating the views from the migration framework: it would permit the creation of a few helper to execute this SQL outside of the migrations (django-pgtrigger
does something like that).What are your thoughts?
References: