1
0
mirror of https://github.com/django/django.git synced 2024-12-29 04:26:28 +00:00
Commit Graph

73 Commits

Author SHA1 Message Date
Mariusz Felisiak
21e6864715
Fixed RecorderTests.test_has_table_cached() on databases that perform multiple queries when introspecting tables.
Thanks Tim Graham for the report and implementation idea.

Follow up to ea8cbca579.
2023-06-28 12:11:25 +02:00
Tom Forbes
ea8cbca579 Made MigrationRecorder cache has_table() result if django_migrations table exists. 2023-05-25 13:18:02 +02:00
Nick Pope
d3cb91db87 Used more augmented assignment statements.
Identified using the following command:

$ git grep -I '\(\<[_a-zA-Z0-9]\+\>\) *= *\1 *[-+/*^%&|<>@]'
2022-10-31 12:30:13 +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
Jacob Walls
9e17cc062c Refs #24900 -- Added MigrationLoader test for applying squashed migrations. 2021-08-30 11:40:27 +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
Hasan Ramezani
a2e3f95b09 Fixed #31413 -- Fixed isolation of migrations.test_loader on databases that don't support transactions. 2020-12-31 08:18:51 +01:00
William Schwartz
e64c1d8055 Fixed #32302 -- Allowed migrations to be loaded from regular packages with no __file__ attribute.
The migrations loader prevents the use of PEP-420 namespace packages
for holding apps' migrations modules. Previously the loader tested for
this only by checking that app.migrations.__file__ is present. This
prevented migrations' being found in frozen Python environments that
don't set __file__ on any modules. Now the loader *additionally* checks
whether app.migrations.__path__ is a list because namespace packages
use a different type for __path__. Namespace packages continue to be
forbidden, and, in fact, users of normal Python environments should
experience no change whatsoever.
2020-12-29 12:54:08 +01:00
Tim Graham
ff55adbd0d
Reverted "Fixed #30300 -- Allowed migrations to be loaded from directories without __init__.py file."
This reverts commit 3cd3bebe89.
2020-07-22 07:04:06 +02:00
Simon Charette
06889d6206 Fixed #31499 -- Stored ModelState.fields into a dict.
This allows the removal of its O(n) .get_field_by_name method and many
other awkward access patterns.

While fields were initially stored in a list to preserve the initial
model definiton field ordering the auto-detector doesn't take field
ordering into account and no operations exists to reorder fields of a
model.

This makes the preservation of the field ordering completely superflous
because field reorganization after the creation of the model state
wouldn't be taken into account.
2020-04-22 07:10:00 +02:00
Benjy Weinberger
3cd3bebe89 Fixed #30300 -- Allowed migrations to be loaded from directories without __init__.py file. 2019-10-10 08:31:41 +02:00
Tim Schilling
371ddade1e Refs #30186 -- Changed MigrationRecorder.applied_migrations() to return a dict. 2019-03-07 19:36:55 -05:00
Simon Charette
8c775391b7 Refs #28478 -- Deprecated TestCase's allow_database_queries and multi_db in favor of databases. 2019-01-10 19:11:21 -05:00
Tim Graham
32fbccab40
Fixed #29749 -- Made the migrations loader ignore files starting with a tilde or underscore.
Regression in 29150d5da8.
2018-09-11 12:51:11 -04:00
Tim Graham
63f90f55f3 Fixed #29498 -- Fixed a missing pyc test file in source distribution. 2018-06-15 14:18:08 -04:00
Jon Dufresne
f3b1c3bd06 Refs #23406 -- Fixed "invalid escape sequence" warning in migrations test. 2018-04-02 22:54:05 -04:00
Dan Watson
29150d5da8 Fixed #23406 -- Allowed migrations to be loaded from .pyc files. 2018-03-23 13:20:38 -04:00
Carlton Gibson
5b083a824e Fixed #29180 -- Fixed a regression where migrations already in the plan were readded.
Regression in a38ae914d8.
2018-03-09 08:59:57 +01:00
Jon Dufresne
2c69824e5a Refs #23968 -- Removed unnecessary lists, generators, and tuple calls. 2017-06-01 19:08:59 -04:00
Tim Graham
ab83d4d8fe Added multi_db=True to test cases that access the 'other' db connection.
Fixed a failure in the context processors tests when running in
reverse on MySQL due to an extra query after refs #27683.
2017-02-10 08:19:32 -05:00
Tim Graham
29f607927f Fixed spelling of "nonexistent". 2017-02-03 08:01:45 -05:00
Claude Paroz
c716fe8782 Refs #23919 -- Removed six.PY2/PY3 usage
Thanks Tim Graham for the review.
2017-01-18 16:21:28 +01:00
Claude Paroz
d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
Tim Graham
8119b679eb Refs #27025 -- Fixed "invalid escape sequence" warnings in Python 3.6.
http://bugs.python.org/issue27364
2016-09-17 15:44:06 -04:00
Tim Graham
6989b45c8d Fixed typo in tests/migrations/test_loader.py. 2016-09-16 11:15:20 -04:00
Tim Graham
098c07a032 Fixed #27142, #27110 -- Made makemigrations consistency checks respect database routers.
Partially reverted refs #27054 except for one of the tests as this
solution supersedes that one.

Thanks Shai Berger for the review.
2016-09-01 16:19:29 -04:00
Simon Charette
0d7929266e Fixed #25109 -- Stopped silencing explicitly specified migration modules import errors.
Thanks Tim for the review.
2016-08-30 19:50:42 -04:00
Tim Graham
ad25fe7350 Fixed #27089 -- Added database alias to InconsistentMigrationHistory message. 2016-08-23 17:39:58 -04:00
Jim Nicholls
76ab885118 Fixed #27054 -- Fixed makemigrations crash with a read-only database. 2016-08-18 08:27:40 -04:00
Jarek Glowacki
d117567c7d Fixed #27004 -- Made migrations consistency check ignore unapplied squashed migrations. 2016-08-05 18:01:55 -04:00
Tim Graham
944e66cb1d Reverted "Fixed #25388 -- Added an option to allow disabling of migrations during test database creation"
This reverts commit 157d7f1f1d since it
disables migrations all the time, not just during tests.
2016-07-14 09:21:28 -04:00
Jarek Glowacki
80bf3135d0 Sorted migration list order in test; added trailing comma. 2016-05-08 13:53:36 +02:00
Jarek Glowacki
509379a161 Fixed #25945, #26292 -- Refactored MigrationLoader.build_graph() 2016-05-08 13:53:26 +02:00
Attila Tovt
02ae5fd31a Fixed #25850 -- Made migrate/makemigrations error on inconsistent history. 2016-04-05 08:52:08 -04:00
Berker Peksag
14e6823d09 Refs #25388 -- Used in-memory database in test_disable_migrations. 2016-03-23 10:55:30 -04:00
Berker Peksag
157d7f1f1d Fixed #25388 -- Added an option to allow disabling of migrations during test database creation 2016-03-23 08:21:30 +08:00
Tim Graham
8ad7b8118c Used addCleanup() to call recorder.flush() in migration loader tests. 2016-02-24 11:22:09 -05:00
Markus Holtermann
a3c01b0dd8 Fixed #24919 -- Allowed disabling of migrations on a per app basis 2015-09-12 10:38:15 +10:00
Carl Meyer
84522c0d16 Fixed #24895 -- Fixed loading a pair of squashed migrations with a dependency. 2015-06-02 12:07:54 -06:00
Marten Kenbeek
d73176a842 Fixed #24848 -- Fixed ValueError for faulty migrations module.
Added apps to unmigrated apps if the migrations module is a file
or a folder missing __init__.py.

Thanks to Ernest0x for the bug report.
2015-05-25 13:47:50 -04:00
Markus Holtermann
811d7870a5 Moved migration exception classes to shared module
Thanks Aymeric Augustin for the review.
2015-05-02 12:54:44 +02:00
Tim Graham
0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Tim Graham
c0cc8f69e7 Refactored tests that rely on an ImportError for Python 3.5 compatibility
A change in Python test discovery [1] causes the old packages that raised
an error to be discovered; now we use a common directory that's
ignored during discovery. Refs #23763.

[1] http://bugs.python.org/issue7559
2015-02-03 18:30:46 -05:00
twidi
fd061b6591 Fixed #23733 -- Fixed squashing migrations that depend on multiple apps. 2014-10-30 14:39:11 -04:00
Markus Holtermann
85086c8158 Fixed #23556 -- Raised a more meaningful error message when migrations refer to an unavailable node 2014-10-30 00:17:29 +01: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
Claude Paroz
885ff6845e Revert "Fixed #23384 -- Allowed overriding part of a dictionary-type setting"
This reverts commit 66757fee7e.
Discussions have led to think that this functionality does not
bring significant benefits to justify the added complexity.
Read also discussions on ticket #22734.
2014-09-05 20:06:02 +02:00
Claude Paroz
66757fee7e Fixed #23384 -- Allowed overriding part of a dictionary-type setting
This change is needed for upcoming changes where settings might be
grouped in a parent dictionary.
Thanks Tim Graham for the review.
2014-08-30 12:37:10 +02:00