Closed gonzalomolbar closed 2 years ago
Hello @gonzalomolbar !
Thank you for the comment :) Yes package is open for contributors
Yes, you probably have right, it seems to be caused by state_forwards
implemented from the last lib upgrade
If you have a good solution please share it :) I will try to solve it during the weekend
@gonzalomolbar Please try new version from https://pypi.org/project/django-db-views/0.1.4/ or here from master branch.
I fixed issue by detecting whether it is view migration or regular make migration command. This was the best what I was able to do during the weekend to make lib work again.
Thank you once again for your comment, and please let me know if you have better solution. I will try to find one as soon as I get some more free time
When I try to create a view with this package, the next migration is created as expected through
makeviewmigrations
:(I've obfuscated names and sql)
But then, when I run
makemigration
I've dug into the library a little and looks like this is because of the way
ViewRunPython
implementsstate.add_model
, providing a lot of different fields that won't be detected as the model created inmakemigrations
and such it will create the "actual good one" and delete this "bad one", the one created through this library.Look out at the name of the Model is deleting
TABLE_NAME_django.db.backends.postgresql_psycopg2
, which it comes fromget_table_engine_name_hash
. Yet, the actual DB name isTABLE_NAME
, which is even different from the actualMODEL_NAME
I wonder if this is something wrong with my setup or an actual issue of the package. I would find this hard to believe since it looks like it's quite used...
I have an idea of what could be fixed if this package is open for contributions! And of course, is this if an actual issue and not something with my own setup...
Thanks in advance!
Run with
Python 3.8.13
andDjango 3.2.15