Jacob Walls
8914f4703c
Fixed #35972 -- Fixed lookup crashes after subquery annotations.
2025-08-04 10:14:01 +02:00
Clifford Gama
45ba7683a6
Refs #36438 -- Made FieldOperation.references_field() detect references in GeneratedField.expression.
...
Thanks to Simon Charette for the suggestion and review.
2025-07-25 13:59:13 +02:00
Clifford Gama
1a7fc0f65d
Fixed #36438 -- Made MigrationAutodetector remove generated fields before their base fields.
...
Thanks to Colton Saska for the report and to Simon Charette for the review.
2025-07-25 13:59:13 +02:00
django-bot
69a93a88ed
Refs #36500 -- Rewrapped long docstrings and block comments via a script.
...
Rewrapped long docstrings and block comments to 79 characters + newline
using script from https://github.com/medmunds/autofix-w505 .
2025-07-23 20:17:55 -03:00
Mike Edmunds
55b0cc2131
Refs #36500 -- Shortened some long docstrings and comments.
...
Manually reformatted some long docstrings and comments that would be
damaged by the to-be-applied autofixer script, in cases where editorial
judgment seemed necessary for style or wording changes.
2025-07-23 20:17:55 -03:00
Sarah Boyce
1ecf6889ca
Removed double spaces after periods and within phrases.
2025-07-23 10:09:43 -03:00
wookkl
29f5e1e97d
Fixed #35595 , #35962 -- Removed indexes and constraints before fields in migrations.
2025-06-27 17:17:45 +02:00
Jacob Walls
b2407e4d7d
Fixed #35305 -- Avoided recreating constraints on fields renamed via db_column.
2025-06-23 14:06:14 +02:00
Jacob Walls
56f468681a
Refs #35038 -- Reduced CreateModel/AlterConstraint operations when optimizing migrations.
2025-06-19 12:22:23 +02:00
Adam Johnson
6e36f7f784
Fixed #36383 -- Improved migration serialization for functools.partial objects.
2025-05-13 21:42:19 -03:00
Adam Johnson
57fdc104d2
Refs #36383 -- Added extra tests for serializing functools.partial in tests/migrations/test_writer.py.
...
This includes a test helper to better assert over the expected output.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-05-13 21:42:19 -03:00
Adam Johnson
4647e2b866
Refs #36383 -- Extended DeconstructibleSerializer to support non-identifier keyword arguments.
...
In Python, keyword arguments must normally be valid identifiers (i.e.,
variable names that follow Python's naming rules). However, Python dicts
can have keys that aren't valid identifiers, like "foo-bar" or "123foo".
This commit ensures that keyword arguments that are nt valid
identifiers, are properly handled when deconstructing an object.
2025-05-13 21:42:19 -03:00
Thibaut Decombe
825ddda26a
Fixed #33174 -- Fixed migrations crash for model inheriting from Generic[T].
2025-05-12 17:39:20 +01:00
Mikuláš Poul
494d2dc316
Fixed #36274 -- Added support for run_before and atomic in MigrationWriter.
2025-04-16 10:20:49 +02:00
Jacob Walls
a0fb35eb72
Fixed #36184 -- Allowed migrating forward to squashed migrations.
2025-04-01 09:35:37 +02:00
Song Junho
126417be43
Fixed #36265 -- Added support for serialization of ZoneInfo instances in migrations.
2025-03-31 13:44:54 +02:00
petr.prikryl
2a5aca38bb
Fixed #35487 -- Removed CASCADE from RemoveField() on PostgreSQL.
...
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: Adam Johnson <me@adamj.eu>
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2025-03-09 11:50:17 +01:00
Mariusz Felisiak
efb7f9ced2
Refs #36005 -- Used datetime.UTC alias instead of datetime.timezone.utc.
...
datetime.UTC was added in Python 3.11.
2025-02-18 08:35:36 +01:00
Georgi Yanchev
0ee842bb45
Fixed #36146 -- Recorded applied/unapplied migrations recursively.
2025-02-13 12:52:06 +01:00
Ben Cail
db7b1ae9f6
Refs #22997 -- Prevented requesting a default value for auto fields.
2025-02-06 13:53:43 +01:00
Georgi Yanchev
64b1ac7292
Fixed #24529 -- Allowed double squashing of migrations.
...
Co-authored-by: Raphael Gaschignard <raphael@rtpg.co>
2025-01-22 10:56:30 +01:00
Simon Charette
20eb4bca7d
Refs #373 -- Adjusted test allowing AutoField in composite primary keys.
...
This is not a properly supported feature yet and should be revisited by
refs #35957 .
2025-01-13 11:13:29 +01:00
Mariusz Felisiak
c534b6c493
Fixed #35991 -- Fixed crash when adding non-nullable field after renaming part of CompositePrimaryKey on SQLite.
2024-12-27 09:55:42 -03:00
Aman Sharma
f05edb2b43
Fixed #36016 -- Prevented traceback when quitting makemigrations with Ctrl-C.
2024-12-19 11:33:18 +01:00
lufafajoshua
27375ad50e
Fixed #35969 -- Disallowed specifying a USING clause for altered generated field.
...
PostgreSQL versions 16.5 and above no longer permit the use
of a USING clause when changing the type of a generated column.
2024-12-17 11:27:25 +01:00
Andrés Reverón Molina
b44efdfe54
Fixed #34856 -- Fixed references to index_together in historical migrations.
...
While AlterUniqueTogether has been documented to be still allowed in historical
migrations for the foreseeable future it has been crashing since 2abf417c815c20
was merged because the latter removed support for Meta.index_together which the
migration framework uses to render models to perform schema changes.
CreateModel(options["unique_together"]) was also affected.
Refs #27236 .
Co-authored-by: Simon Charette <charette.s@gmail.com>
2024-12-17 09:59:39 +01:00
Jacob Walls
2ce4545de1
Fixed #35920 -- Observed requires_system_checks in migrate and runserver.
...
Before, the full suite of system checks was run by these commands
regardless if requires_system_checks had been overridden.
Co-authored-by: Simon Charette <charette.s@gmail.com>
2024-12-11 17:25:47 +01:00
Jacob Walls
d345e5b5f8
Fixed #35935 -- Colorized system checks when running sqlmigrate.
2024-12-09 08:31:25 +01:00
Jacob Walls
58cc91275a
Fixed #35308 -- Handled OSError when launching code formatters.
...
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2024-11-29 09:04:48 -03:00
Bendeguz Csirmaz
978aae4334
Fixed #373 -- Added CompositePrimaryKey.
...
Thanks Lily Foote and Simon Charette for reviews and mentoring
this Google Summer of Code 2024 project.
Co-authored-by: Simon Charette <charette.s@gmail.com>
Co-authored-by: Lily Foote <code@lilyf.org>
2024-11-29 11:23:04 +01:00
Salvo Polizzi
b82f80906a
Fixed #35038 -- Created AlterConstraint operation.
2024-11-28 17:40:52 +01:00
Salvo Polizzi
b92511b474
Refs #35038 -- Added test for drop and recreation of a constraint.
2024-11-28 17:40:52 +01:00
Adam Johnson
e035db1bc3
Fixed #35882 -- Made migration questioner loop on all errors.
2024-11-18 15:15:44 +01:00
Adam Johnson
3434fab758
Refs #35882 -- Added test for migration questioner KeyboardInterrupt.
2024-11-18 15:15:44 +01:00
leondaz
06bf06a911
Fixed #35656 -- Added an autodetector attribute to the makemigrations and migrate commands.
2024-10-15 16:39:12 +02:00
Adam Johnson
f5ddd54986
Fixed #35704 -- Fixed reduction for AddIndex subclasses.
2024-09-03 12:51:06 +02:00
Jacob Walls
4082a8886e
Fixed #35724 -- Tested migration commands handling of distributed namespace packages.
...
Also increased coverage of module_loading.py.
2024-09-03 08:07:53 +02:00
Adam Johnson
20d44abb41
Fixed #35700 -- Added AlterModelTable and AlterModelTableComment reductions.
2024-08-30 18:50:12 +02:00
Sarah Boyce
3dac3271d2
Reverted "Fixed #28646 -- Prevented duplicate index when unique is set to True on PostgreSQL."
...
This reverts commit 9cf9c796be8dd53bc3b11355ff39d65c81d7be6d due to a crash on Oracle
as it didn't allow multiple indexes on the same field.
2024-08-01 09:25:33 +02:00
Ben Cail
9cf9c796be
Fixed #28646 -- Prevented duplicate index when unique is set to True on PostgreSQL.
2024-07-30 17:27:10 +02:00
Simon Charette
f359990e49
Fixed #35625 -- Fixed a crash when adding a field with db_default and check constraint.
...
This is the exact same issue as refs #30408 but for creating a model with a
constraint containing % escapes instead of column addition. All of these issues
stem from a lack of SQL and parameters separation from the BaseConstraint DDL
generating methods preventing them from being mixed with other parts of the
schema alteration logic that do make use of parametrization on some backends
(e.g. Postgres, MySQL for DEFAULT).
Prior to the addition of Field.db_default and GeneratedField in 5.0
parametrization of DDL was never exercised on model creation so this is
effectively a bug with db_default as the GeneratedField case was addressed by
refs #35336 .
Thanks Julien Chaumont for the report and Mariusz Felisiak for the review.
2024-07-25 07:48:53 +02:00
Daniel Patrick
d12184fedc
Fixed #35424 -- Checked order_with_respect_to is available when migrating _order fields.
...
Migrations would crash following the removal of an order_with_respect_to
field from a model and the addition of an _order field.
2024-07-10 08:40:50 +02:00
Mariusz Felisiak
fa78481467
Refs #34881 -- Fixed OperationTests.test_rename_m2m_field_with_2_references() test on Oracle.
2024-06-14 19:52:09 +02:00
Anže Pečar
e99187e5c9
Fixed #34881 -- Fixed a crash when renaming a model with multiple ManyToManyField.through references on SQLite.
...
Thank you to dennisvang for the report and Jase Hackman for the test.
Co-authored-by: Jase Hackman <jase.hackman@zapier.com>
2024-06-13 17:49:22 +02:00
Tim Graham
bcbc4b9b8a
Fixed typo in migrations test name.
2024-05-23 17:19:48 +02:00
Mariusz Felisiak
91a4b9a8ec
Fixed #35422 -- Fixed migrations crash when altering GeneratedField referencing rename field.
...
Thanks Sarah Boyce for the report and Simon Charette for the
implementation idea.
2024-05-03 09:28:24 +02:00
DevilsAutumn
9aeb38c296
Fixed #35359 -- Fixed migration operations ordering when adding fields referenced by GeneratedField.expression.
...
Thank you to Simon Charette for the review.
2024-05-02 21:43:13 -03:00
Mariusz Felisiak
a2dcc4ecbb
Increased test coverage for django.db.migrations.operations.special.
2024-03-25 08:31:32 +01:00
Mariusz Felisiak
1c11dba835
Added ModelState.from_model() test for abstract model with unnamed indexes.
2024-03-22 13:31:33 +01:00
Ben Cail
593067a8ee
Fixed #28541 -- Fixed migrations crash when changing primary key on SQLite.
2024-03-14 20:56:43 +01:00