BezBartek / django-db-views

Creating automatic migrations for Views models witch working reverse and full command options like in normal makemigrations
MIT License
62 stars 12 forks source link

Testing: compatibility with -no-migrations mode #24

Open benjaminrigaud opened 1 year ago

benjaminrigaud commented 1 year ago

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:

BezBartek commented 1 year ago

@benjaminrigaud Thank you for your thoughts I will try to get deeper into it through the weekend

benjaminrigaud commented 8 months ago

Hi,

If I implement a fix, would you have time to review it? :bow:

Ben

BezBartek commented 8 months ago

Hello @benjaminrigaud Please do so, thank you! Apologize that I didn't find time to write it I will review your code and merge

lajus commented 2 months ago

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

benjaminrigaud commented 2 months ago

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: