#34510: sqlmigrate does not follows replaces in squashed migrations
-------------------------------------+-------------------------------------
Reporter: NeodymiumFerBore | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 4.2
commands) |
Severity: Normal | Resolution:
Keywords: squashed migration | Triage Stage:
replaces sqlmigrate command core | Unreviewed
management |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by NeodymiumFerBore):
* cc: NeodymiumFerBore (added)
Old description:
> The sqlmigrate command does not follow `replaces` in squashed migration,
> with original (squashed) migration files deleted. This ticket is roughly
> the same than #32205, #33583 and #31318. In #31318, the issue is marked
> as solved with commit
> [https://github.com/django/django/commit/d88365708c554efe3c786c3be6da1d9de916360f
> d883657]. Since then, `MigrationLoader` accepts the argument
> `replace_migrations`. However,
> [https://github.com/django/django/blob/d88365708c554efe3c786c3be6da1d9de916360f/django/core/management/commands/sqlmigrate.py#L37
> the loader instance here] has this option to `False`. I don't see a
> command option to set it to `True`.
>
> I tried to set it to `True` manually in 4.1.7, and it successfully showed
> SQL queries involved in the migration I wanted to inspect.
> `sqlmigrate.py` has not changed between 4.1.7 and 4.2, so I guess it also
> affects it.
>
> [https://github.com/django/django/blob/4.1.7/django/core/management/commands/sqlmigrate.py#L46
> Link: MigrationLoader instance in 4.1.7 L46]
> [https://github.com/django/django/blob/4.2/django/core/management/commands/sqlmigrate.py#L46
> Link: MigrationLoader instance in 4.2 L46]
> [https://github.com/django/django/blob/main/django/core/management/commands/sqlmigrate.py#L46
> Link: MigrationLoader instance in main L46]
>
> I see that it always has been like this since commit `d883657`. Now maybe
> I don't understand why it works like so. Could you explain why it is set
> to `False` with no option to set it to `True`? Is it unreliable?
>
> Thank you.
New description:
Hello!
The `sqlmigrate` command does not follow `replaces` in squashed migration,
with original (squashed) migration files deleted. This ticket is roughly
the same than #32205, #33583 and #31318. In #31318, the issue is marked as
solved with commit
[https://github.com/django/django/commit/d88365708c554efe3c786c3be6da1d9de916360f
d883657]. Since then, `MigrationLoader` accepts the argument
`replace_migrations`. However,
[https://github.com/django/django/blob/d88365708c554efe3c786c3be6da1d9de916360f/django/core/management/commands/sqlmigrate.py#L37
the loader instance here] has this option to `False`. I don't see a
command option to set it to `True`.
I tried to set it to `True` manually in 4.1.7, and it successfully showed
SQL queries involved in the migration I wanted to inspect. `sqlmigrate.py`
has not changed between 4.1.7 and 4.2, so I guess it also affects it.
[https://github.com/django/django/blob/4.1.7/django/core/management/commands/sqlmigrate.py#L46
Link: MigrationLoader instance in 4.1.7 L46]
[https://github.com/django/django/blob/4.2/django/core/management/commands/sqlmigrate.py#L46
Link: MigrationLoader instance in 4.2 L46]
[https://github.com/django/django/blob/main/django/core/management/commands/sqlmigrate.py#L46
Link: MigrationLoader instance in main L46]
I see that it always has been like this since commit `d883657`. Now maybe
I don't understand why it works like so. Could you explain why it is set
to `False` with no option to set it to `True`? Is it unreliable?
Thank you.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/34510#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070187ab92ef98-819d9d21-bd3b-4095-88a2-621ed2e9d4ce-000000%40eu-central-1.amazonses.com.