Commit Graph

764 Commits

Author SHA1 Message Date
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
andrewdotn 9e6d631697
Fixed #33246 -- Made squashmigrations raise CommandError when squashed_name already exists. 2021-11-02 07:13:42 +01:00
Iuri de Silvio afeafd6036 Fixed #33201 -- Made RenameModel operation a noop for models with db_table. 2021-10-27 12:41:29 +02: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
Hannes Ljungberg 86971c4090 Fixed #33194 -- Fixed migrations when altering a field with functional indexes/unique constraints on SQLite.
This adjusts Expressions.rename_table_references() to only update alias
when needed.

Regression in 83fcfc9ec8.

Co-authored-by: Simon Charette <charettes@users.noreply.github.com>
2021-10-18 08:25:23 +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
Jacob Walls 32f1fe5f89 Fixed #29470 -- Logged makemigrations automatic decisions in non-interactive mode. 2021-10-12 15:19:39 +02:00
Jacob Walls 241ba23870 Refs #29470 -- Added makemigrations test for adding fields with no default and auto_now_add=True in non-interactive mode. 2021-10-12 15:19:39 +02:00
Mariusz Felisiak 01bf679e59
Fixed #33022 -- Fixed isolation of migrations.test_executor.ExecutorTests.test_custom_user(). 2021-10-08 15:51:04 +02:00
Jacob Walls 47f791f132 Fixed #23408 -- Added migrations questioner prompt for adding unique fields with a callable default. 2021-10-06 08:05:33 +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
Carlton Gibson 306607d5b9 Fixed #32365 -- Made zoneinfo the default timezone implementation.
Thanks to Adam Johnson, Aymeric Augustin, David Smith, Mariusz Felisiak, Nick
Pope, and Paul Ganssle for reviews.
2021-09-16 12:11:05 +02:00
Mariusz Felisiak 1eb3f500a4
Fixed #33057 -- Fixed recreation of foreign key constraints in m2m tables when altering type of referenced primary key on Oracle. 2021-08-31 13:43:10 +02:00
Jacob Walls 3219dd3388 Fixed #24900 -- Allowed migrating backward to squashed migrations. 2021-08-30 12:08:04 +02:00
Jacob Walls 9e17cc062c Refs #24900 -- Added MigrationLoader test for applying squashed migrations. 2021-08-30 11:40:27 +02:00
Mateo Radman 02bc7161ec Fixed #32900 -- Improved migrations questioner prompts. 2021-08-27 13:27:41 +02:00
Mateo Radman 61c5eae516 Refs #32900 -- Added makemigrations tests for messages in interactive mode. 2021-08-27 13:27:41 +02:00
Mateo Radman d00fb4d2d6 Refs #32900 -- Added test for ignoring the default value in InteractiveMigrationQuestioner.ask_not_null_alteration(). 2021-08-27 13:27:37 +02:00
Mariusz Felisiak fa1d7ba5b9
Refs #29898 -- Changed fields in ProjectState's relation registry to dict. 2021-08-26 07:49:37 +02:00
Manav Agarwal 196a99da5d Refs #29898 -- Made ProjectState encapsulate alterations in relations registry.
Thanks Simon Charette and Chris Jerdonek for reviews.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-08-25 09:12:01 +02:00
Chris Jerdonek 7800596924 Fixed #33014 -- Made ProjectState raise exception when real_apps argument is not a set. 2021-08-19 10:18:51 +02:00
Mariusz Felisiak 54a30a7a00 Refs #29898 -- Changed ProjectState.real_apps to set. 2021-08-11 09:01:14 +02:00
Jacob Walls 910ecd1b8d Fixed #29063 -- Fixed migrate crash when specifying a name of partially applied squashed migrations. 2021-08-04 09:57:32 +02:00
Jacob Walls 202d3e193a Fixed typos in migrations tests, comments, and error message. 2021-08-04 09:28:23 +02:00
Mariusz Felisiak 52f9cfee9f Used assertRaisesMessage() to test MigrationLoader.get_migration_by_prefix()'s error messages. 2021-08-04 09:20:26 +02:00
David Smith 1cba320786
Refs #32956 -- Changed "afterwards" to "afterward" in docs and comments.
This also removes unnecessary comments with the previous spelling.

AP Stylebook has a short entry to advise the preferred spelling for
"en-us". "Afterwards" is preferred in British English.
2021-07-27 10:41:51 +02:00
Jordan Bae 3d9040a50b Refs #32743 -- Fixed recreation of foreign key constraints when altering type of referenced primary key with MTI.
Follow up to 325d7710ce.
2021-07-27 07:30:33 +02:00
David Wobrock 325d7710ce Fixed #32743 -- Added foreign key altering when altering type of referenced primary key with MTI. 2021-07-26 08:51:56 +02:00
abhiabhi94 fde6fb2898 Fixed #32893 -- Fixed serialization of models.Model class in migrations.
Migrations assumed that an import of the models.Model class must
already be included when it's serialized, but for models with only
custom fields this was not necessarily the case.

Thanks Jaap Joris Vens for the report.
2021-07-01 12:42:32 +02:00
Jacob Walls 2dfc1066a0 Fixed #25250 -- Clarified partially recorded state of squashed migrations in showmigrations --list. 2021-06-11 09:35:42 +02:00
Jacob Walls c0e29cec83 Fixed #25255 -- Recorded unapplied squashed migrations. 2021-06-08 08:40:34 +02:00
luzpaz bbf09254a3
Fixed typos in test comments. 2021-06-07 20:54:28 +02:00
Chris Jerdonek 7272e1963f Fixed #32821 -- Updated os.scandir() uses to use a context manager. 2021-06-07 06:52:42 +02:00
Hannes Ljungberg 3e0fdf5546
Fixed #32780 -- Made Add/RemoveConstraint operations a noop for covering/deferrable unique constraints on SQLite. 2021-05-25 11:34:25 +02:00
Nick Pope d06c5b3581 Fixed #32366 -- Updated datetime module usage to recommended approach.
- Replaced datetime.utcnow() with datetime.now().
- Replaced datetime.utcfromtimestamp() with datetime.fromtimestamp().
- Replaced datetime.utctimetuple() with datetime.timetuple().
- Replaced calendar.timegm() and datetime.utctimetuple() with datetime.timestamp().
2021-05-12 11:08:41 +02:00
Nick Pope 6b7960188b Added extra assertion to migrations.test_writer.WriterTests.test_serialize_datetime.
This checks that datetime.timezone.utc serializes correctly.
2021-05-12 11:06:30 +02:00
Hannes Ljungberg eab71f7690 Fixed #32686 -- Removed unnecessary semicolon on collected multiline SQL for RunSQL. 2021-04-27 08:01:07 +02:00
Hannes Ljungberg 95754dbc9b Refs #32686 -- Added tests for adding a semicolon when collecting SQL for RunSQL. 2021-04-27 07:59:41 +02:00
Mariusz Felisiak 2f435e75ab
Fixed isolation of test_showmigrations_unmigrated_app().
Follow up to 90916f050c.
2021-04-23 10:06:08 +02:00
Mariusz Felisiak 90916f050c
Fixed isolation of test_showmigrations_unmigrated_app(). 2021-04-22 17:43:58 +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
Hannes Ljungberg 3aa545281e Fixed #30916 -- Added support for functional unique constraints.
Thanks Ian Foote and Mariusz Felisiak for reviews.
2021-02-23 20:19:53 +01:00
Hannes Ljungberg 87acbf0631 Fixed #32458 -- Made __repr__() for Index and BaseConstraint subclasses more consistent. 2021-02-19 20:25:11 +01:00