django squashmigrations creating incorrect code?

137 views
Skip to first unread message

Christian González

unread,
Dec 22, 2022, 4:12:27 PM12/22/22
to django-developers

Hi devs,

before I file a bug, small check here:

I squashed my migrations using "./manage.py squashmigrations  core 0003"

It squashed all existing 3 migrations, including a runPython migration in 0001.

The resulting migration contains this code:

migrations.RunPython(
code=medux.core.migrations.0001_initial.create_admin_user,
),

Which is not working, as Python complains:

File "/home/christian/Projekte/medux/src/medux/core/migrations/0001_squashed_0003_alter_address_id_alter_addressmapper_id_and_more.py", line 57
    code=medux.core.migrations.0001_initial.create_admin_user,
                                   ^
SyntaxError: invalid decimal literal

So I suppose that is not intended. Is this a django bug? Should I file this as issue?

Cheers,

Christian


-- 
Dr. Christian González
https://nerdocs.at

Christian González

unread,
Dec 22, 2022, 4:13:26 PM12/22/22
to django-developers

AH, sorry. Just saw it:

# Functions from the following migrations need manual copying.
# Move them and any dependencies into this file, then update the
# RunPython operations to refer to the local versions:
# medux.core.migrations.0001_initial

Am 22.12.22 um 22:12 schrieb Christian González:
--
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-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/286d7666-41eb-12ef-44b5-640993f480c3%40nerdocs.at.

Naresh Pahariya

unread,
Dec 22, 2022, 6:05:38 PM12/22/22
to django-d...@googlegroups.com

Christian González

unread,
Dec 23, 2022, 6:18:39 AM12/23/22
to django-d...@googlegroups.com
HM wouldn't it be better to add a stdout message after completing the squash? Because if the cmd doesn't say anything, the user assumes that everything went well. I wasn't aware of squash migrations being even that smart to recognise RunPython methods.
So a stdout.write() with more or less this message would help a lot.
Christian

Adam Johnson

unread,
Dec 26, 2022, 10:02:10 AM12/26/22
to django-d...@googlegroups.com
Yes, a single line message warning that the migration needs some edits would be nice.

--
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-develop...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages