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
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
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
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
2abf417c81
Refs #27236 -- Removed Meta.index_together per deprecation timeline.
2023-09-18 22:12:40 +02: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
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
Ian Foote
7414704e88
Fixed #470 -- Added support for database defaults on fields.
...
Special thanks to Hannes Ljungberg for finding multiple implementation
gaps.
Thanks also to Simon Charette, Adam Johnson, and Mariusz Felisiak for
reviews.
2023-05-12 19:11:40 +02:00
Mariusz Felisiak
8e2460d599
Fixed #34529 , Refs #34525 -- Reduced index operations with Meta.indexes/index_together when optimizing migrations.
...
This makes squashing migrations an available path for changing
Meta.index_together, which is deprecated, to Meta.indexes.
Follow up to f810325721
.
2023-05-03 13:06:19 +02:00
Durval Carvalho
4b1bfea284
Fixed #34333 -- Fixed migration operations ordering when adding index/constraint on new foreign key.
...
Thanks Simon Charette and David Wobrock for reviews.
2023-03-10 07:05:11 +01:00
Nick Pope
1282b5e420
Fixed #32528 -- Replaced django.utils.topological_sort with graphlib.TopologicalSort().
...
graphlib.TopologicalSort() is available since Python 3.9.
2023-01-19 06:31:40 +01:00
kimsoungryoul
78f163a4fb
Fixed #18468 -- Added support for comments on columns and tables.
...
Thanks Jared Chung, Tom Carrick, David Smith, Nick Pope, and Mariusz
Felisiak for reviews.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2022-12-28 06:28:07 +01:00
Adam Johnson
cd03e8e2d6
Fixed #34050 -- Replaced invalid chars in migration names with '_'.
...
Thanks to Bishal Gautam for the report and initial implementation.
Regression in fa58450a9a
.
Co-Authored-By: Bishal Gautam <bisalgt@gmail.com>
2022-09-27 08:02:51 +02:00
Simon Charette
71902e0d9f
Fixed #33938 -- Fixed migration crash for m2m with a through model in another app.
...
Regression in aa4acc164d
.
Thanks bryangeplant for the report.
2022-08-25 10:03:57 +02:00
David Wobrock
a6385b382e
Fixed #27236 -- Deprecated Meta.index_together in favor of Meta.indexes.
...
This also deprecates AlterIndexTogether migration operation.
2022-07-12 09:04:31 +02:00
David Wobrock
db588d4f0e
Refs #27236 -- Split index_together and unique_together autodetector tests.
2022-06-13 09:03:36 +02:00
David Wobrock
457cfd6f39
Refs #27236 -- Added test_autodetector.BaseAutodetectorTests.
2022-06-13 08:55:25 +02:00
David Wobrock
798b6c23ee
Fixed #31788 -- Fixed migration optimization after altering field to ManyToManyField.
...
This makes AddField() used for altering to ManyToManyField, dependent
on the prior RemoveField.
2022-06-02 12:10:27 +02:00
David Wobrock
97f124f39e
Refs #27064 -- Made migrations generate RenameIndex operations when moving indexes from index_together to Meta.indexes.
2022-05-17 07:21:36 +02:00
David Wobrock
c6cec3c2d2
Refs #27064 -- Made migrations generate RenameIndex operations when renaming Meta.indexes.
2022-05-16 17:46:24 +02:00
Brian Helba
2d5215c675
Fixed #33605 -- Fixed migration crash when altering RegexValidator to pre-compiled regular expression.
2022-04-04 07:38:15 +02:00
Mariusz Felisiak
1e2e1be02b
Fixed #33515 -- Prevented recreation of migration for ManyToManyField to lowercased swappable setting.
...
Thanks Chris Lee for the report.
Regression in 4328970780
.
Refs #23916 .
2022-02-16 21:09:24 +01:00
Mariusz Felisiak
7119f40c98
Refs #33476 -- Refactored code to strictly match 88 characters line length.
2022-02-07 20:37:05 +01:00
django-bot
9c19aff7c7
Refs #33476 -- Reformatted code with Black.
2022-02-07 20:37:05 +01:00
Kirill Safronov
97a7274468
Fixed #33480 -- Fixed makemigrations crash when renaming field of renamed model.
...
Regression in aa4acc164d
.
2022-02-01 07:01:41 +01:00
David Wobrock
482ee63b6f
Fixed #33402 -- Optimized multiple AlterFooTogether operations.
2022-01-04 06:24:03 +01:00
Simon Charette
4328970780
Fixed #33366 -- Fixed case handling with swappable setting detection in migrations autodetector.
...
The migration framework uniquely identifies models by case insensitive
labels composed of their app label and model names and so does the app
registry in most of its methods (e.g. AppConfig.get_model) but it
wasn't the case for get_swappable_settings_name() until this change.
This likely slipped under the radar for so long and only regressed in
b9df2b74b9
because prior to the changes
related to the usage of model states instead of rendered models in the
auto-detector the exact value settings value was never going through a
case folding hoop.
Thanks Andrew Chen Wang for the report and Keryn Knight for the
investigation.
2021-12-17 07:46:58 +01:00
Baptiste Mispelon
a0ed3cfad1
Fixed #33305 -- Fixed autodetector crash for ForeignKey with hardcoded "to" attribute.
...
Co-authored-by: Simon Charette <charette.s@gmail.com>
2021-11-22 06:46:25 +01:00
Mariusz Felisiak
dab48b7482
Fixed #33234 -- Fixed autodetector crash for proxy models inheriting from non-model class.
...
Regression in aa4acc164d
.
Thanks Kevin Marsh for the report.
2021-11-02 15:34:08 +01:00
Mariusz Felisiak
d446f8ba08
Corrected AutodetectorTests.test_rename_field_and_foo_together()'s docstring.
2021-10-26 08:46:50 +02:00
David Wobrock
0314593fe8
Fixed #31503 -- Made autodetector remove unique/index_together before altering fields.
2021-10-25 10:10:02 +02:00
Simon Charette
5896aa8367
Fixed #33197 -- Made field rename with prior matching db_column change a noop.
...
Thanks Jacob Walls for the report.
2021-10-19 06:46:35 +02:00
Jacob Walls
15683cdb95
Fixed #23953 -- Made makemigrations continue number sequence for squashed migrations.
2021-10-15 06:59:31 +02:00
Jacob Walls
6e4ac28af0
Refs #23953 -- Added MigrationAutodetector.parse_number() tests.
2021-10-15 06:59:31 +02:00
AliGhotbizadeh
b8f3a3ad54
Refs #33119 -- Added tests for changing model name case referenced by ManyToManyField.
...
Fixed in aa4acc164d
.
2021-09-20 12:00:10 +02:00
Mariusz Felisiak
54a30a7a00
Refs #29898 -- Changed ProjectState.real_apps to set.
2021-08-11 09:01:14 +02:00
David Wobrock
aa4acc164d
Fixed #29899 -- Made autodetector use model states instead of model classes.
...
Thanks Simon Charette and Markus Holtermann for reviews.
2021-04-16 11:18:10 +02:00
manav014
99640e24b4
Fixed #31516 -- Improved naming of migrations with multiple operations.
...
52 gives 60 in total (52 + 5 + 3).
Co-authored-by: Adam Johnson <me@adamj.eu>
2021-03-12 11:56:12 +01:00
Adam Johnson
927fead2f5
Refs #31516 -- Added Migration.suggest_name() tests for migrations with no operations.
2021-03-12 11:56:12 +01:00
Adam Johnson
b1cb923883
Refs #31516 , Refs #31703 -- Made makemigrations always name initial migrations "initial".
2021-03-12 09:19:23 +01:00
Koen De Wit
4c0b4720b0
Fixed #31954 -- Fixed migration optimization for MTI model creation with parent model with mixed case app label.
2020-08-28 13:35:13 +02:00
Iuri de Silvio
58a336a674
Fixed #31831 -- Fixed migration operations ordering when adding order_with_respect_to and constraints/indexes.
2020-08-08 20:43:45 +02:00
Iuri de Silvio
366a93f174
Refs #31831 -- Added autodector test for unique/index_together on _order field.
2020-08-08 20:43:40 +02:00
Jon Dufresne
6f3e3e87ab
Fixed #31703 -- Made makemigrations name all initial migrations "initial".
...
When the MigrationAutodetector creates more than one initial migration
in a app, name all initial migrations "initial" rather than the opaque
"auto_<DATE>_<TIME>" name.
Initial migrations that have a descriptive name continue to use the
descriptive name.
2020-06-24 07:18:45 +02:00
Jon Dufresne
01195c4a83
Refs #31703 -- Added Migration.suggest_name() test for initial migration with multiple CreateModels.
2020-06-24 07:18:38 +02:00
Jon Dufresne
bce180dd05
Refs #31703 -- Moved MigrationAutodetector.suggest_name() to Migration.
...
Allows expanding the method to inspect additional attributes of the
migration instance. For example, the Migration.initial attribute.
2020-06-24 07:01:11 +02:00
Adam Johnson
fa58450a9a
Fixed #31468 -- Allowed specifying migration filename in Operation.
...
This adds also suggested filename for many built-in operations.
2020-05-28 11:42:53 +02:00