Anyway, I suspect disabling migration - even if a
"master-switch" could be built - is undesirable if one is using any of
the django tables.
--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/de18bd57-ad18-4464-8783-009e26abced2%40googlegroups.com.
> We're working with databases and their representations in application layer, and not vice versa.Speak for yourself, I'm working with the models, saving them in the database is just an implementation detail
What does "turning off migrations" mean in practice? Is it not enough to avoid the makemigrations and migrate management commands?
> Maybe there is a solution for both?
Sometimes when you have unusual requirements you have to do a little
more work to meet them. To my knowledge, out of the many hundreds of
thousands of Django users, you are the first and only one to request a
way to turn off migrations entirely.
It is not possible to build a framework where _everything_ is easy. We
aim for "Simple things should be easy, advanced things should be possible."
Changing the database accidentally can be avoided simply by adjusting the privileges of the database user django uses.
The thing is, nobody ever requested that, it is not a popular feature request, so, it is not there and won't be there unless someone contributes with a solid patch and a solid case for this added complexity
To my knowledge, out of the many hundreds of
thousands of Django users, you are the first and only one to request a
way to turn off migrations entirely.
I would like to provide solid patch as a pull request, but I'm afraid that it will be rejected due to some kind of spirit, politics or something else.
BR,Marcin
It is not possible to build a framework where _everything_
this is not so advanced thing, and it looks almostis easy. We aim for "Simple things should be easy, advanced things should be possible." Carl
W dniu 25.08.2015 o 19:04, Marcin Nowak pisze:
Marcin, please - consider sharing your patch on GitHub (or similar)
I would like to provide solid patch as a pull request, but I'm afraid that it will be rejected due to some kind of spirit, politics or something else.
BR,Marcin
with a documentation, because:
this is not so advanced thing, and it looks almostIt is not possible to build a framework where _everything_ is easy. We aim for "Simple things should be easy, advanced things should be possible." Carl
impossible to solve in Django.
With current architecture around migrations Django
is database owner, not one of the database services.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/486d3e2e4179fbd43336f900899b7e9b%40gearscape.net.
For more options, visit https://groups.google.com/d/optout.
With current architecture around migrations Django
is database owner, not one of the database services.
+1 for disabling migrations completely - for several reasons.1. Right now, I'm trying to run tests against a production database with runserver, in *read-only* mode - but it fails because it can't create the django_migrations table. (I'm in the process of upgrading from Django 1.4 to 1.8, so the table doesn't yet exist in production.)
2. Our mysql database is 3TB, with some tables of up to 500GB - and I assume that migrating them with Django - without taking the system down for days - is not possible. Instead, we use Percona's pt-online-schema-change, which does an excellent job of migrating big tables, whilst keeping them fully usable with no downtime.
Either way - we recently hit another Django limitation - as best I've been able to tell, joining a table with itself seems to be very poorly supported - so we're heading towards SqlAlchemy, and probably away from Django altogether in time.
If you're building some report-like queries, or any static queries, I would suggest to use raw sql.You can optionally wrap results with model instances using Model.objects.raw().
Yeah, good call perhaps. We're certainly drawn to raw sql (which we all know fairly well) compared to learning Django's tricks for complex queries, but the originator of our project chose to write lots of unit tests using sqlite (instead of our production mysql) for speed and simplicity reasons (notwithstanding questions of incompatibility) - so an ORM offers some extra value currently due to SQL differences that can be handled automatically. On first glance SA appears a little more like SQL than Django's query language - though I'm sure there's times when I may tear my hair out wanting raw SQL.
Hi,
We've been hitting this issue as well in our environment - so far we've been able to workaround this by using fake migrations but that is not long lasting solution.
We're using Oracle as our database backend and we have hundreds of legacy databases which aren't unified at their schema but there are some little differences here and there.
Now, when Django creates migrations it does them "wrong". Oracle doesn't have concept of transactioned DDL, but Django assumes every backend does - thus it automatically creates migrations so that it squashes all migrations done since last migration to one. And that causes the problem. With Oracle each migration should be individually runnable so if one crashes it can't leave database in unknown state.
For example if my migration adds column in tables A, B and C. If
A success but B fails in Oracle it means that even migration
failed A got applied requiring manual work to also roll back
manually those changes.
So, instead of Django migrations we decided to go with liquibase
for database migrations since it has better workflow and concepts
for migrations in Oracle.
--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a93ba892-599a-4677-9895-cb88ce36b01d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- Jani Tiainen