1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00
Commit Graph

899 Commits

Author SHA1 Message Date
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 2abf417c81
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 9cf9c796be 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
Simon Charette
daf7d482db Refs #35234 -- Deprecated CheckConstraint.check in favor of .condition.
Once the deprecation period ends CheckConstraint.check() can become the
documented method that performs system checks for BaseConstraint
subclasses.
2024-03-01 07:15:32 +01:00
Moein Bbp
cf107fe255 Fixed #35122 -- Made migrate --prune option respect --app_label. 2024-02-13 14:47:49 +01:00
David Sanders
06264258dc Fixed #35175 -- Made migraton writer preserve keyword-only arguments.
Thanks Gerald Goh for the report.
2024-02-09 09:37:13 +01:00
Ben Cail
8b7ddd1b62 Refs #34534 -- Reduced constraint operations with Meta.constraints when optimizing migrations. 2024-02-09 07:02:52 +01:00
Simon Charette
e67d7d70fa Fixed #35149 -- Fixed crashes of db_default with unresolvable output field.
Field.db_default accepts either literal Python values or compilables
(as_sql) and wrap the former ones in Value internally.

While 1e38f11 added support for automatic resolving of output fields for
types such as str, int, float, and other unambigous ones it's cannot do
so for all types such as dict or even contrib.postgres and contrib.gis
primitives.

When a literal, non-compilable, value is provided it likely make the
most sense to bind its output field to the field its attached to avoid
forcing the user to provide an explicit `Value(output_field)`.

Thanks David Sanders for the report.
2024-02-04 09:39:41 +01:00
Mariusz Felisiak
305757aec1
Applied Black's 2024 stable style.
https://github.com/psf/black/releases/tag/24.1.0
2024-01-26 12:45:07 +01:00
Amir Karimi
27a3eee721 Fixed #31700 -- Made makemigrations command display meaningful symbols for each operation. 2024-01-17 14:00:02 +01:00
David Wobrock
7045661069 Fixed #35022 -- Fixed RenameIndex() crash on unnamed indexes if exists unique constraint on the same fields. 2023-12-22 12:47:17 +01:00
Prashant Pandey
a8adb6aa6c Fixed #26827 -- Improved ModelState error message when relations refer model classes. 2023-11-23 21:17:44 +01:00
Sarah Boyce
828082dad9 Fixed #34984 -- Skipped GeneratedFields when remaking tables on SQLite.
Regression in f333e3513e8bdf5ffeb6eeb63021c230082e6f95.t

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: David Sanders <shang.xiao.sanders@gmail.com>
2023-11-22 12:29:14 +01:00
Mariusz Felisiak
5875f03ce6 Fixed #34944 -- Made GeneratedField.output_field required.
Regression in f333e3513e.
2023-11-14 20:22:07 +01:00
Adam Johnson
f7389c4b07 Fixed #34457 -- Restored output for makemigrations --check.
Co-authored-by: David Sanders <shang.xiao.sanders@gmail.com>
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2023-11-09 10:03:19 -03:00
Simon Charette
8a28e983df
Fixed #34946 -- Preserved db_default on combined default field addition.
Regression in 7414704e88.
2023-11-07 13:32:34 +03:00
David Sanders
1944f490f9 Refs #34936 -- Added test for altering DecimalField with db_default to non-nullable. 2023-11-02 17:57:34 +01:00
Mariusz Felisiak
2abf417c81 Refs #27236 -- Removed Meta.index_together per deprecation timeline. 2023-09-18 22:12:40 +02:00
Natalia
691f70c477 Fixed #24561 -- Added support for callables on model fields' choices. 2023-09-14 10:15:33 -03:00
Nick Pope
f92e68c30a Fixed #34822 -- Added support for serializing functions decorated with functools.lru_cache in migrations.
`@functools.cache` and `@functools.lru_cache` return an object of type
`functools._lru_cache_wrapper` which prevented the migrations serializer from
working. Simply using the existing `FunctionTypeSerializer` for this additional
type works as expected.
2023-09-13 15:57:18 -03:00
Nick Pope
c131949e3e Refs #34822 -- Added tests for serializing decorated functions in migrations.
Functions decorated with a decorator that is properly wrapped, e.g. by
using `@functools.wraps`, are already supported.
2023-09-13 15:39:56 -03:00
donghao
938170008e Fixed #34824 -- Prevented unnecessary AlterField when ForeignObject.from_fields/to_fields is not a tuple. 2023-09-11 08:46:43 +02:00
donghao
71820c9f91 Fixed #34820 -- Fixed migrations crash when changing a ForeignObject field. 2023-09-09 22:15:14 +02:00
Jeremy Nauta
f333e3513e Fixed #31300 -- Added GeneratedField model field.
Thanks Adam Johnson and Paolo Melchiorre for reviews.

Co-Authored-By: Lily Foote <code@lilyf.org>
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2023-09-07 06:19:08 +02:00
Nick Pope
500e01073a
Fixed #31262 -- Added support for mappings on model fields and ChoiceField's choices. 2023-08-30 22:57:40 -03:00
David Sanders
76c3e310dd Fixed #34744 -- Prevented recreation of migration for constraints with a dict_keys.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2023-08-23 11:42:18 +02:00