Re: Do people actually squash migrations?

2021-05-11 Thread Andrew Godwin
Migration squashing was always meant to be something that was useful in a rapid 
development environment where you can't control all the installs (since it was 
a feature developed alongside a CMS run by many clients at the time).

If you have control of all the places your project is installed and can have 
everyone developing on it do something at once, you can just do it via a 
complete migration reset and be happy. Squashing is for a very specific 
backwards-compatibility scenario that, I suspect, many Django projects 
developed internally are not in.

Andrew

On Tue, May 11, 2021, at 7:58 PM, Kye Russell wrote:
> I’ve never successfully squashed my migrations to any material degree, but 
> I’ve chalked that up to lack of doing it with any regularity. I suspect that 
> squashing works a lot better if you aren’t trying to clean up a mess of 
> hundreds of migrations files over 5 years, which is where I find myself! 
> 
> Kye
> On 12 May 2021, 9:31 AM +0800, Matthew Pava , wrote:
> 
>> I've had similar issues. I just avoid squashing anymore. It's just not with 
>> the pain, and having so many little files that get looked at a minimal 
>> amount of time isn't worth fretting over. Saying that, I'd love to get it 
>> fixed...
>> 
>> 
>> Sent from my Verizon, Samsung Galaxy smartphone
>> 
>> Get Outlook for Android 
>> 
>> 
>> *From:* 'Mike Lissner' via Django developers (Contributions to Django 
>> itself) 
>> *Sent:* Tuesday, May 11, 2021 7:50:31 PM
>> *To:* Django developers (Contributions to Django itself) 
>> 
>> *Subject:* Do people actually squash migrations? 
>>  
>> I have a pretty big django project, and since I created the 100th migration 
>> within one of its apps today, I thought I'd finally do some squashing. It 
>> hasn't gone well, but I eventually got the data migrations cleaned up.
>> 
>> Finally, I run it, and it runs smack into a CircularDependencyError, as 
>> described here:
>> 
>> https://code.djangoproject.com/ticket/23337
>> 
>> Basically, from what I understand, after the squash you have one migration 
>> that depends on various others from your other apps. Naturally, that totally 
>> falls over, because can't go from this series of migrations:
>> 
>> app1: migration 1
>> app2: migration 1
>> app2: migration 2
>> app1: migration 2
>> 
>> To, well...any series of migrations in which migration 1&2 from app1 or app2 
>> have been squashed. The docs have something to say about this*, but it feels 
>> like this must affect practically any biggish project.
>> 
>> Stackoverflow also has a variety of dubious (and very complex) advice (read 
>> it and weep):
>> 
>> https://stackoverflow.com/questions/37711402/circular-dependency-when-squashing-django-migrations
>> 
>> So, my question is: Do people actually use squashmigrations with success? 
>> And if not, is it reasonable to consider deprecating it or fixing the bug, 
>> or updating the docs to loudly say it largely doesn't work? I'm surprised 
>> the issue above has so little movement since it was created seven years ago.
>> 
>> Maybe it's just me? If not, it'd be nice to do something to help future 
>> people with ambitions of a simple squash.
>> 
>> Thanks,
>> 
>> 
>> Mike
>>  
>> * Note that model interdependencies in Django can get very complex, and 
>> squashing may result in migrations that do not run; either mis-optimized (in 
>> which case you can try again with --no-optimize, though you should also 
>> report an issue), or with a CircularDependencyError, in which case you can 
>> manually resolve it.
>> To manually resolve a CircularDependencyError, break out one of the 
>> ForeignKeys in the circular dependency loop into a separate migration, and 
>> move the dependency on the other app with it. If you’re unsure, see how 
>> makemigrations 
>> 
>>  deals with the problem when asked to create brand new migrations from your 
>> models. In a future release of Django, squashmigrations 
>> 
>>  will be updated to attempt to resolve these errors itself. [Author's note: 
>> These sentences really leave me blowing in the wind...maybe I can figure out 
>> what they mean, I guess? I thought squashing was supposed to be easy.]

>> 
>> 
>> 

>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group 

Re: Do people actually squash migrations?

2021-05-11 Thread Benny
Sorry in advance of this isn’t helpful - We’ve done it successfully a few times 
since 1.11… but not without a sacrifice of the virgins-in-volcano variety. Just 
about any kind of RunPython command seems to get in the way. And sometimes it’s 
easier to blow them all away and create fresh migrations.

I have faith in migration squashing. It feels like more art than science, and 
to be sure - dealing with a database is more art than science in general… 
especially with all the creative minds that have access to such a logical 
system. I believe squashing should be used with care, and mostly on systems 
with ideal schema. Aside of that, I’ve worked on projects with migrations in 
the several-hundreds which took long enough to stand up that I could get a 
coffee and continue working.

All that said, I think it’s a nice-to-have feature, but ultimately isn’t 
necessary for the vast majority of projects. 

Benny

> On May 11, 2021, at 7:50 PM, 'Mike Lissner' via Django developers 
> (Contributions to Django itself)  wrote:
> 
> I have a pretty big django project, and since I created the 100th migration 
> within one of its apps today, I thought I'd finally do some squashing. It 
> hasn't gone well, but I eventually got the data migrations cleaned up. 
> 
> Finally, I run it, and it runs smack into a CircularDependencyError, as 
> described here:
> 
> https://code.djangoproject.com/ticket/23337
> 
> Basically, from what I understand, after the squash you have one migration 
> that depends on various others from your other apps. Naturally, that totally 
> falls over, because can't go from this series of migrations:
> 
> app1: migration 1
> app2: migration 1
> app2: migration 2
> app1: migration 2
> 
> To, well...any series of migrations in which migration 1&2 from app1 or app2 
> have been squashed. The docs have something to say about this*, but it feels 
> like this must affect practically any biggish project. 
> 
> Stackoverflow also has a variety of dubious (and very complex) advice (read 
> it and weep):
> 
> https://stackoverflow.com/questions/37711402/circular-dependency-when-squashing-django-migrations
> 
> So, my question is: Do people actually use squashmigrations with success? And 
> if not, is it reasonable to consider deprecating it or fixing the bug, or 
> updating the docs to loudly say it largely doesn't work? I'm surprised the 
> issue above has so little movement since it was created seven years ago. 
> 
> Maybe it's just me? If not, it'd be nice to do something to help future 
> people with ambitions of a simple squash.
> 
> Thanks,
> 
> 
> Mike
>  
> * Note that model interdependencies in Django can get very complex, and 
> squashing may result in migrations that do not run; either mis-optimized (in 
> which case you can try again with --no-optimize, though you should also 
> report an issue), or with a CircularDependencyError, in which case you can 
> manually resolve it.
> To manually resolve a CircularDependencyError, break out one of the 
> ForeignKeys in the circular dependency loop into a separate migration, and 
> move the dependency on the other app with it. If you’re unsure, see how 
> makemigrations deals with the problem when asked to create brand new 
> migrations from your models. In a future release of Django, squashmigrations 
> will be updated to attempt to resolve these errors itself. [Author's note: 
> These sentences really leave me blowing in the wind...maybe I can figure out 
> what they mean, I guess? I thought squashing was supposed to be easy.]
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/87f449bc-d653-427a-ac28-879ee0701c8bn%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/E949F021-480A-40C3-9C98-2B1BDE95C368%40twosensedesign.com.


Re: Do people actually squash migrations?

2021-05-11 Thread Kye Russell
I’ve never successfully squashed my migrations to any material degree, but I’ve 
chalked that up to lack of doing it with any regularity. I suspect that 
squashing works a lot better if you aren’t trying to clean up a mess of 
hundreds of migrations files over 5 years, which is where I find myself!

Kye
On 12 May 2021, 9:31 AM +0800, Matthew Pava , wrote:
> I've had similar issues. I just avoid squashing anymore. It's just not with 
> the pain, and having so many little files that get looked at a minimal amount 
> of time isn't worth fretting over. Saying that, I'd love to get it fixed...
>
> Sent from my Verizon, Samsung Galaxy smartphone
> Get Outlook for Android
>
> From: 'Mike Lissner' via Django developers (Contributions to Django itself) 
> 
> Sent: Tuesday, May 11, 2021 7:50:31 PM
> To: Django developers (Contributions to Django itself) 
> 
> Subject: Do people actually squash migrations?
>
> I have a pretty big django project, and since I created the 100th migration 
> within one of its apps today, I thought I'd finally do some squashing. It 
> hasn't gone well, but I eventually got the data migrations cleaned up.
>
> Finally, I run it, and it runs smack into a CircularDependencyError, as 
> described here:
>
> https://code.djangoproject.com/ticket/23337
>
> Basically, from what I understand, after the squash you have one migration 
> that depends on various others from your other apps. Naturally, that totally 
> falls over, because can't go from this series of migrations:
>
> app1: migration 1
> app2: migration 1
> app2: migration 2
> app1: migration 2
>
> To, well...any series of migrations in which migration 1&2 from app1 or app2 
> have been squashed. The docs have something to say about this*, but it feels 
> like this must affect practically any biggish project.
>
> Stackoverflow also has a variety of dubious (and very complex) advice (read 
> it and weep):
>
> https://stackoverflow.com/questions/37711402/circular-dependency-when-squashing-django-migrations
>
> So, my question is: Do people actually use squashmigrations with success? And 
> if not, is it reasonable to consider deprecating it or fixing the bug, or 
> updating the docs to loudly say it largely doesn't work? I'm surprised the 
> issue above has so little movement since it was created seven years ago.
>
> Maybe it's just me? If not, it'd be nice to do something to help future 
> people with ambitions of a simple squash.
>
> Thanks,
>
>
> Mike
>
> * Note that model interdependencies in Django can get very complex, and 
> squashing may result in migrations that do not run; either mis-optimized (in 
> which case you can try again with --no-optimize, though you should also 
> report an issue), or with a CircularDependencyError, in which case you can 
> manually resolve it.
> To manually resolve a CircularDependencyError, break out one of the 
> ForeignKeys in the circular dependency loop into a separate migration, and 
> move the dependency on the other app with it. If you’re unsure, see how 
> makemigrations deals with the problem when asked to create brand new 
> migrations from your models. In a future release of Django, squashmigrations 
> will be updated to attempt to resolve these errors itself. [Author's note: 
> These sentences really leave me blowing in the wind...maybe I can figure out 
> what they mean, I guess? I thought squashing was supposed to be easy.]
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/87f449bc-d653-427a-ac28-879ee0701c8bn%40googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups 
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/SN6PR05MB3951135EF4ECFE249F51ED4BF1529%40SN6PR05MB3951.namprd05.prod.outlook.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/76351f53-d185-4dd1-9979-6a7c73015ef5%40Spark.


Re: Do people actually squash migrations?

2021-05-11 Thread Matthew Pava
I've had similar issues. I just avoid squashing anymore. It's just not with the 
pain, and having so many little files that get looked at a minimal amount of 
time isn't worth fretting over. Saying that, I'd love to get it fixed...

Sent from my Verizon, Samsung Galaxy smartphone
Get Outlook for Android


From: 'Mike Lissner' via Django developers (Contributions to Django itself) 

Sent: Tuesday, May 11, 2021 7:50:31 PM
To: Django developers (Contributions to Django itself) 

Subject: Do people actually squash migrations?

I have a pretty big django project, and since I created the 100th migration 
within one of its apps today, I thought I'd finally do some squashing. It 
hasn't gone well, but I eventually got the data migrations cleaned up.

Finally, I run it, and it runs smack into a CircularDependencyError, as 
described here:

https://code.djangoproject.com/ticket/23337

Basically, from what I understand, after the squash you have one migration that 
depends on various others from your other apps. Naturally, that totally falls 
over, because can't go from this series of migrations:

app1: migration 1
app2: migration 1
app2: migration 2
app1: migration 2

To, well...any series of migrations in which migration 1&2 from app1 or app2 
have been squashed. The docs have something to say about this*, but it feels 
like this must affect practically any biggish project.

Stackoverflow also has a variety of dubious (and very complex) advice (read it 
and weep):

https://stackoverflow.com/questions/37711402/circular-dependency-when-squashing-django-migrations

So, my question is: Do people actually use squashmigrations with success? And 
if not, is it reasonable to consider deprecating it or fixing the bug, or 
updating the docs to loudly say it largely doesn't work? I'm surprised the 
issue above has so little movement since it was created seven years ago.

Maybe it's just me? If not, it'd be nice to do something to help future people 
with ambitions of a simple squash.

Thanks,


Mike

* Note that model interdependencies in Django can get very complex, and 
squashing may result in migrations that do not run; either mis-optimized (in 
which case you can try again with --no-optimize, though you should also report 
an issue), or with a CircularDependencyError, in which case you can manually 
resolve it.

To manually resolve a CircularDependencyError, break out one of the ForeignKeys 
in the circular dependency loop into a separate migration, and move the 
dependency on the other app with it. If you’re unsure, see how 
makemigrations
 deals with the problem when asked to create brand new migrations from your 
models. In a future release of Django, 
squashmigrations
 will be updated to attempt to resolve these errors itself. [Author's note: 
These sentences really leave me blowing in the wind...maybe I can figure out 
what they mean, I guess? I thought squashing was supposed to be easy.]



--
You received this message because you are subscribed to the Google Groups 
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/87f449bc-d653-427a-ac28-879ee0701c8bn%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/SN6PR05MB3951135EF4ECFE249F51ED4BF1529%40SN6PR05MB3951.namprd05.prod.outlook.com.


Do people actually squash migrations?

2021-05-11 Thread 'Mike Lissner' via Django developers (Contributions to Django itself)
I have a pretty big django project, and since I created the 100th migration 
within one of its apps today, I thought I'd finally do some squashing. It 
hasn't gone well, but I eventually got the data migrations cleaned up. 

Finally, I run it, and it runs smack into a CircularDependencyError, as 
described here:

https://code.djangoproject.com/ticket/23337

Basically, from what I understand, after the squash you have one migration 
that depends on various others from your other apps. Naturally, that 
totally falls over, because can't go from this series of migrations:

app1: migration 1
app2: migration 1
app2: migration 2
app1: migration 2

To, well...any series of migrations in which migration 1&2 from app1 or 
app2 have been squashed. The docs have something to say about this*, but it 
feels like this must affect practically any biggish project. 

Stackoverflow also has a variety of dubious (and very complex) advice (read 
it and weep):

https://stackoverflow.com/questions/37711402/circular-dependency-when-squashing-django-migrations

So, my question is: Do people actually use squashmigrations with success? 
And if not, is it reasonable to consider deprecating it or fixing the bug, 
or updating the docs to loudly say it largely doesn't work? I'm surprised 
the issue above has so little movement since it was created seven years 
ago. 

Maybe it's just me? If not, it'd be nice to do something to help future 
people with ambitions of a simple squash.

Thanks,


Mike
 
* Note that model interdependencies in Django can get very complex, and 
squashing may result in migrations that do not run; either mis-optimized 
(in which case you can try again with --no-optimize, though you should also 
report an issue), or with a CircularDependencyError, in which case you can 
manually resolve it.

To manually resolve a CircularDependencyError, break out one of the 
ForeignKeys in the circular dependency loop into a separate migration, and 
move the dependency on the other app with it. If you’re unsure, see how 
makemigrations 

 
deals with the problem when asked to create brand new migrations from your 
models. In a future release of Django, squashmigrations 

 
will be updated to attempt to resolve these errors itself. [Author's note: 
These sentences really leave me blowing in the wind...maybe I can figure 
out what they mean, I guess? I thought squashing was supposed to be easy.]


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/87f449bc-d653-427a-ac28-879ee0701c8bn%40googlegroups.com.


Hi i'm new on python and django!

2021-05-11 Thread Juan Leon
anyone can help me to understandt how i can start in django, with any 
tips... because in the moment when i clone the project in local i saw 
commits with "hastags", for example: #123 what is the significate of this 
and how can i work with that? 

i am going to really appreciate yours answers 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/a53086e4-86f6-4371-9fc5-048fad19df61n%40googlegroups.com.