1
0
mirror of https://github.com/django/django.git synced 2025-01-06 08:25:50 +00:00
Commit Graph

773 Commits

Author SHA1 Message Date
Jacob Walls
6f78cb6b13 Fixed #29026 -- Added --scriptable option to makemigrations. 2022-01-10 18:49:57 +01:00
Allen Jonathan David
28c98d4113 Fixed #33216 -- Simpilified deconstructed paths for some expressions. 2022-01-07 11:19:29 +01:00
David Wobrock
482ee63b6f
Fixed #33402 -- Optimized multiple AlterFooTogether operations. 2022-01-04 06:24:03 +01:00
Jacob Walls
0ab58c1209 Refs #29026 -- Allowed customizing InteractiveMigrationQuestioner's prompt destination.
Previously, the questioner did not obey the value of stdout provided
to the command.
2022-01-03 12:30:51 +01:00
Jacob Walls
92412aa94c Fixed #23273 -- Avoided creation of django_migrations table when there are no migrations to apply. 2021-12-30 06:36:55 +01:00
Mariusz Felisiak
2d07e1aaeb
Refs #22983 -- Added tests for squashing migrations with functions from migration files.
Follow up to ebb13bbd88.
2021-12-27 18:49:19 +01:00
Jacob Walls
03cadb912c Removed a Python error message dependency in test_questioner_no_default_bad_user_entry_code(). 2021-12-20 11:11:39 +01:00
Jacob Walls
1833a9eee9 Increased test coverage of django.db.migrations.questioner. 2021-12-20 11:11:39 +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
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