Commit Graph

98 Commits

Author SHA1 Message Date
Dražen Odobašić b1e33ceced Fixed #23395 -- Limited line lengths to 119 characters. 2015-09-12 11:40:50 -04:00
Markus Holtermann 8e631a3175 Refs #24590 -- Ensured isolation between autodetector tests
Fixed a regression introduced in e1427cc609 when running tests in reverse order.
2015-08-28 10:17:34 +10:00
Markus Holtermann 91f701f4fc Fixed #25280 -- Properly checked regex objects for equality to prevent infinite migrations
Thanks Sayid Munawar and Tim Graham for the report, investigation and
review.
2015-08-27 09:52:53 +10:00
Tim Graham 01966bb2a7 Fixed typo in tests/migrations/test_autodetector.py. 2015-08-20 14:52:26 -04:00
Flavio Curella c2e70f0265 Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField 2015-07-27 18:28:13 -04:00
Andrei Kulakov db97a88495 Fixed #24375 -- Added Migration.initial attribute
The new attribute is checked when the `migrate --fake-initial` option
is used. initial will be set to True for all initial migrations (this
is particularly useful when initial migrations are split) as well as
for squashed migrations.
2015-07-13 15:57:40 -04:00
Markus Holtermann 7bb7670ee4 Used mock in MigrationQuestioner tests
Thanks Andriy Sokolovskiy and Simon Charette for the review.
2015-06-23 17:34:22 +02:00
Markus Holtermann e470f311d6 Fixed #24828 -- Allowed migration optimization across AlterFooTogether
The idea behind this change is, that AlterUniqueTogether,
AlterIndexTogether and AlterOrderWithRespectTo can always be moved after
an Add/Alter/Rename/RemoveField operation if they don't refer to the
respective field and are not empty sets / None.

Combined with the optimizations of duplicate AlterUniqueTogether,
AlterIndexTogether, and AlterOrderWithRespectTo operations from
128caa1e16, these operations are optimized
in a later round of the optimizer.

Thanks Tim Graham for the review.
2015-06-16 00:43:22 +02:00
Matt Westcott ff8a02ae0b Fixed #24340 -- Added nested deconstruction for list, tuple and dict values
Nested deconstruction should recursively deconstruct items within list,
tuple and dict values.
2015-05-26 17:10:02 +02:00
Markus Holtermann c7ec3c07e7 Fixed #24537 -- Ignored field order in RenameModel detection
Thanks to David Sanders for the report and test and Simon Charette for
the review.
2015-03-28 20:45:15 +01:00
Anssi Kääriäinen 8f30556329 Renamed Field.rel attribute to remote_field
Field.rel is now deprecated. Rel objects have now also remote_field
attribute. This means that self == self.remote_field.remote_field.

In addition, made the Rel objects a bit more like Field objects. Still,
marked ManyToManyFields as null=True.
2015-03-25 08:16:12 -04:00
Markus Holtermann a9e29fae10 Fixed #24435 -- Prevented m2m field removal and addition in migrations when changing blank
Thanks Mark Tranchant for the report an Tim Graham for the test and
review.
2015-03-04 14:26:49 +01:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Claude Paroz 1aa3e09c20 Fixed #23745 -- Reused states as much as possible in migrations
Thanks Tim Graham and Markus Holtermann for the reviews.
2015-01-02 15:37:10 +01:00
Markus Holtermann fca866763a Added test for an intermediate swappable model change in migration state.
refs #22563
2014-12-30 10:01:25 -05:00
Markus Holtermann 623ccdd598 Fixed #23938 -- Added migration support for m2m to concrete fields and vice versa
Thanks to Michael D. Hoyle for the report and Tim Graham for the review.
2014-12-29 13:41:12 -05:00
Tim Graham 061caa5b38 Fixed #24037 -- Prevented data loss possibility when changing Meta.managed.
The migrations autodetector now issues AlterModelOptions operations for
Meta.managed changes instead of DeleteModel + CreateModel.

Thanks iambibhas for the report and Simon and Markus for review.
2014-12-23 14:25:31 -05:00
Andriy Sokolovskiy d8f3b86a76 Fixed #23405 -- Fixed makemigrations prompt when adding Text/CharField.
A default is no longer required.
2014-12-15 14:41:52 -05:00
Markus Holtermann aa5ef0d4fc Fixed #23822 -- Added support for serializing model managers in migration
Thanks to Shai Berger, Loïc Bistuer, Simon Charette, Andrew Godwin,
Tim Graham, Carl Meyer, and others for their review and input.
2014-12-15 08:34:15 -05:00
Markus Holtermann 44927ba817 Fixed #23956 -- Fixed migration creation for multiple table inheritance 2014-12-11 13:28:21 -05:00
Andrzej Pragacz 72729f844e Fixed #23794 -- Fixed migrations crash when removing a field that's part of index/unique_together. 2014-11-21 10:55:19 -05:00
Patryk Zawadzki 21e21c7bc2 Fixed #23844 -- Used topological sort for migration operation dependency resolution.
This removes the concept of equality between operations to guarantee
compatilibity with Python 3.

Python 3 requires equality to result in identical object hashes. It's
impossible to implement a unique hash that preserves equality as
operations such as field creation depend on being able to accept
arbitrary dicts that cannot be hashed reliably.

Thanks Klaas van Schelven for the original patch in
13d613f800.
2014-11-20 12:49:49 -05:00
Markus Holtermann 2331650835 Cleaned up and reformatted autodetector tests 2014-11-19 11:09:38 -05:00
Markus Holtermann f17acd5930 Formatted model states in autodetector tests 2014-11-19 11:09:38 -05:00
Tim Graham 83d104d61a Revert "Use topological sort for migration operation dependency resolution"
This commit broke the tests on Python 3.

This reverts commit 13d613f800.
2014-11-15 15:28:04 +01:00
Klaas van Schelven 13d613f800 Use topological sort for migration operation dependency resolution
rather than an ad-hoc algorithm
2014-11-15 14:45:42 +01:00
Berker Peksag f7969b0920 Fixed #23620 -- Used more specific assertions in the Django test suite. 2014-11-03 11:56:37 -05:00
Markus Holtermann 5c9c1e029d Fixed #23614 -- Changed the way the migration autodetector orders unique/index_together
Thanks to Naddiseo for the report and Tim Graham for the review
2014-10-29 13:05:42 -04:00
Tianyi Wang 5732424bee Fixed #23629 -- Allowed autodetector to detect changes in Meta.db_table.
Thanks Naddiseo for reporting.
2014-10-20 13:14:44 -04:00
Markus Holtermann f633ba778d Fixed #23609 -- Fixed IntegrityError that prevented altering a NULL column into a NOT NULL one due to existing rows
Thanks to Simon Charette, Loic Bistuer and Tim Graham for the review.
2014-10-09 21:32:06 +07:00
Thomas Chaumeny b2aad7b836 Replaced set([foo, ...]) by {foo, ...} literals. Refs PR 3282.
Thanks Collin Anderson for the review.
2014-09-29 00:01:38 +07:00
Markus Holtermann 215aa4f53b Fixed #23415 -- Added fields for unmanaged and proxy model migrations.
Thanks sky-chen for the report.
2014-09-25 10:25:03 -04:00
Markus Holtermann 6d5958c7a3 Fixed #23452 -- Prevented infinite migrations for empty unique/index_together.
Thanks fwkroon for the report.
2014-09-10 07:54:16 -04:00
Andrew Pinkham 4680d25df2 Fixed #22951 -- Checked for types during deep_deconstruct migration serialization process.
Thanks Sam Hartsfield for the report.
2014-09-08 07:39:09 -04:00
Raffaele Salmaso 1435cfbe8d Fixed #23302 -- Added --name/-n option to makemigrations command 2014-09-02 21:09:18 -04:00
Raffaele Salmaso abd640fbdf Fixed #23341 -- Added migration name to nonexistent migration error in makemigrations. 2014-08-23 19:18:03 -04:00
Markus Holtermann 144cff3f51 Fixed #23322 -- Use resolved swappable model for dependency resolution during makemigrations 2014-08-20 16:04:21 -04:00
Tim Graham d1299fce0e Fixed migrations tests added in refs #23315. 2014-08-20 14:00:59 -04:00
Andrew Godwin 9247da1032 Fixed #23315: Operational dependency fail with mixed create/add 2014-08-19 19:51:12 -07:00
Andrew Godwin 8f9862cd4d Fixed #23275: Unmanaged models kept by autodetector, ignored by ops 2014-08-12 12:49:20 -07:00
Andrew Godwin a338e07735 Fixed #23101: Prefer doing deletes before creates in autodetector.
Makes declined or missed renames still work (but drop data).
2014-07-29 09:38:51 -07:00
Andrew Godwin d6e73a876d Fixed #23121: AlterModelOptions operation not changing state right 2014-07-28 10:47:28 -07:00
Andrew Godwin cb60d22bd9 Fixed #23100: Individual FK creation missing dependencies 2014-07-28 10:32:43 -07:00
Andrew Godwin 805774df1f Fixed #22944: Bad dependency on FK alteration in autodetector 2014-07-26 09:22:19 -07:00
Andrew Godwin ed4812692e Merge pull request #2938 from dekkers/ticket_23071
Fixed #23071 -- Use last migration's name in dependency to other app
2014-07-25 08:53:57 -07:00
Tim Graham 64e75c47ef Fixed #23014 -- Infinite migration regression with unique/index_together. 2014-07-24 14:27:10 -04:00
Jeroen Dekkers 3582698c13 Fixed #23071 -- Use last migration's name in dependency to other app
Changed the autodetector to lookup the name of the other app's last
migration in the graph and use that as dependency instead of using
__latest__.
2014-07-22 01:03:02 +02:00
Andrew Godwin 145d231782 Fixed #23041: Bad base dependencies for proxy models 2014-07-16 09:59:08 -07:00
Tim Graham 9a2ab62977 Fixed #23008 -- Fixed typo causing bad migration dependencies.
Thanks semenov for the report and Florian for investigation.
2014-07-15 08:48:29 -04:00
Andrew Godwin 9e5a37c82d Fix comment 2014-07-10 10:00:31 -07:00