Sunday, July 28, 2019

Re: Running pending migrations in Middleware



On Sunday, July 28, 2019 at 10:10:57 AM UTC-7, James Schneider wrote:


On Sun, Jul 28, 2019, 12:47 AM David Grant <david...@gmail.com> wrote:
Anyone see any problems with running migrations in Middleware?

What's the actual problem you are trying to solve by doing this? This is a bad idea for a number of reasons, and I can't think of any good ones.

I'm using Google AppEngine and I have no access to the server. The alternative is to have the exact same code checked out on my local machine. Connect to the remote database with a special proxy tool that google provides (so the db becomes available on a local port) and then run the migrations. Problems with this are: 1) Hitting the remote database via the proxy is extremely slow, like ridiculously slow and 2) there is a chance I have the wrong local code. ie. this could mean I run some extra migrations or not run enough migrations, thus causing production to be broken.

Ideally I would just run `./manage.py migrate` on the server, but that's just not possibe.

Also a colleague of mine has been doing this for a Java app for years. There's a quick check in middleware for current db version and then it runs migrations if necessary.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d05695c2-b537-4ad5-bbaf-6eb822a8f9e5%40googlegroups.com.

No comments:

Post a Comment