Re: do migrations (Django 1.7+) handle production data?

2015-01-14 Thread Markus Holtermann
Hey Abraham,

to be more specific, when you used South and ran "manage.py
datamigration" [1] you got an empty migration file with a forwards and
backwards method where you had to fill out the blanks and tell South
what to do, e.g. to create a certain object in the database.

With Django's migration system you get the same with running "manage.py
makemigrations --empty". Django will generate an empty migration file
that you can fill with the operations to run.

Django offers "migrations.RunPython" to run arbitrary Python code, and
"migrations.RunSQL" do perform raw SQL queries. (For documentation
please see the links Russell send earlier).

Best

/Markus

[1] http://south.readthedocs.org/en/latest/commands.html#datamigration

On 01/14/2015 01:43 PM, James Bennett wrote:
> On Wed, Jan 14, 2015 at 6:34 AM, Abraham Varricatt <
> abraham.varric...@googlemail.com> wrote:
> 
> To be more specific, the document you link clearly mentions that "Django
>> can’t automatically generate data migrations for you"
>>
>>
>> And this is what puzzles me. If it isn't automated and is something that
>> needs to be done manually, what's so great about it's inclusion in Django
>> 1.7?
>>
> 
> Django cannot read your mind to figure out what specific changes to your
> data you'd like to have happen. So writing the logic of the data migration
> is up to you.
> 
> Django *can* usually deduce the necessary schema changes from examining
> what the models looked like before and after. And that's the difference.
> 

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/54B66F6C.1000607%40markusholtermann.eu.
For more options, visit https://groups.google.com/d/optout.


Re: do migrations (Django 1.7+) handle production data?

2015-01-14 Thread James Bennett
On Wed, Jan 14, 2015 at 6:34 AM, Abraham Varricatt <
abraham.varric...@googlemail.com> wrote:

To be more specific, the document you link clearly mentions that "Django
> can’t automatically generate data migrations for you"
>
>
> And this is what puzzles me. If it isn't automated and is something that
> needs to be done manually, what's so great about it's inclusion in Django
> 1.7?
>

Django cannot read your mind to figure out what specific changes to your
data you'd like to have happen. So writing the logic of the data migration
is up to you.

Django *can* usually deduce the necessary schema changes from examining
what the models looked like before and after. And that's the difference.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/CAL13Cg88m0rV_H7HCQPgsXtUeyrJ7qShnu0KFt55Z%2B7uTuhP-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: do migrations (Django 1.7+) handle production data?

2015-01-14 Thread Abraham Varricatt
To be more specific, the document you link clearly mentions that "Django 
can’t automatically generate data migrations for you"

And this is what puzzles me. If it isn't automated and is something that 
needs to be done manually, what's so great about it's inclusion in Django 
1.7?

Slowly discovering django,
Abraham V.


On Wednesday, January 14, 2015 at 12:56:45 PM UTC+5:30, Russell Keith-Magee 
wrote:
>
>
> On Wed, Jan 14, 2015 at 3:03 PM, Abraham Varricatt <
> abraham@googlemail.com > wrote:
>
>> Hello everyone,
>>
>> One of the biggest features introduced in Django 1.7 are migrations. They 
>> can broadly be classified into 2 types - 
>> * schema migrations
>> * data migrations
>>
>> Schema migrations deal with changes to the database schema. eg - changing 
>> max_digits of a DecimalField.
>> Data migrations revolve around the actual data in your database and are 
>> not automatically taken care of.
>>
>> My question is; 
>>
>> Why is there so much praise for the Django (1.7) migrations feature if it 
>> can't handle data? Yes, I can understand the convenience of schema 
>> migrations, but without it being accompanied by data migrations, what's the 
>> point? (I'm assuming that this is something run on a production 
>> environment. For test/development environments, the data can arguably be 
>> worthless)
>>
>  
> What gave you the impression that Django's migrations doesn't handle data? 
> There's a section in the Migration topic guide in Django's documentation 
> entitled "Data Migrations":
>
> https://docs.djangoproject.com/en/1.7/topics/migrations/#data-migrations
>
> Yours,
> Russ Magee %-)
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/e537c1bb-2516-43b1-9da6-52392ad81352%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: do migrations (Django 1.7+) handle production data?

2015-01-13 Thread Russell Keith-Magee
On Wed, Jan 14, 2015 at 3:03 PM, Abraham Varricatt <
abraham.varric...@googlemail.com> wrote:

> Hello everyone,
>
> One of the biggest features introduced in Django 1.7 are migrations. They
> can broadly be classified into 2 types -
> * schema migrations
> * data migrations
>
> Schema migrations deal with changes to the database schema. eg - changing
> max_digits of a DecimalField.
> Data migrations revolve around the actual data in your database and are
> not automatically taken care of.
>
> My question is;
>
> Why is there so much praise for the Django (1.7) migrations feature if it
> can't handle data? Yes, I can understand the convenience of schema
> migrations, but without it being accompanied by data migrations, what's the
> point? (I'm assuming that this is something run on a production
> environment. For test/development environments, the data can arguably be
> worthless)
>

What gave you the impression that Django's migrations doesn't handle data?
There's a section in the Migration topic guide in Django's documentation
entitled "Data Migrations":

https://docs.djangoproject.com/en/1.7/topics/migrations/#data-migrations

Yours,
Russ Magee %-)

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/CAJxq848Rz1kLjFjUoBs6gASNd1QzKDBGj%3DnY1O-QoLmSkzfwtQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.