Commit Graph

817 Commits

Author SHA1 Message Date
Jacob Walls 80d38de52b Fixed #34051 -- Made makemigrations --check exit before making migrations. 2022-09-28 09:48:07 +02:00
JunKi Yoon 1a7b6909ac Fixed #34052 -- Made migrate --check don't emit signals and output when up to date. 2022-09-27 21:10:30 +02: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
David Sanders 9f8c994851 Fixed #34027 -- Fixed migrations crash when altering type of char/text fields referenced by foreign key on PostgreSQL. 2022-09-25 20:23:01 +02:00
Mariusz Felisiak a9e7beb959
Refs #33953 -- Fixed test_rename_model_with_db_table_rename_m2m() crash on SQLite < 3.20. 2022-08-29 10:07:53 +02:00
Iuri de Silvio 166a3b3263 Fixed #33953 -- Reverted "Fixed #33201 -- Made RenameModel operation a noop for models with db_table."
Regression in afeafd6036.
This reverts afeafd6036.

Thanks Timothy Thomas for the report.
2022-08-26 06:14:44 +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
Willem Van Onsem 16fffc829c Fixed #33916 -- Added support for serialization of enum.Flag in migrations. 2022-08-25 06:43:48 +02:00
Willem Van Onsem 08688bd7dd Refs #33916 -- Added tests for serialization of enum.Flag in migrations. 2022-08-16 07:52:27 +02:00
Alberto Planas 4e13b40a76
Fixed #33887 -- Fixed test_fails_squash_migration_manual_porting() on final tags.
Regression in 7c318a8bdd.
2022-08-03 16:36:04 +02:00
Mariusz Felisiak c773d5794e Refs #27236 -- Reverted AlterIndexTogether deprecation.
This partly reverts a6385b382e.
2022-07-26 11:41:19 +02:00
Mariusz Felisiak f810325721
Refs #27236 -- Made cosmetic edits to Meta.index_together deprecation.
This should make it more straightforward to move forward when
deprecation ends.
2022-07-21 07:05:50 +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 4f284115a9 Refs #27236 -- Split RenameField() tests with unique/index_together. 2022-07-12 06:38:03 +02:00
David Wobrock e286ce17ff Fixed #24870 -- Added --update option to makemigrations command. 2022-06-17 07:50:39 +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 b949e40e8c Fixed #23740 -- Fixed removing unique_together constraint if exists primary key/unique constraint on the same field. 2022-05-26 08:33:07 +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
David Wobrock 11310e9abb Fixed #33710 -- Made RenameIndex operation a noop when the old and new name match. 2022-05-16 10:36:56 +02:00
David Wobrock eacd4977f6 Refs #27064 -- Added RenameIndex migration operation. 2022-05-12 20:44:03 +02:00
Mariusz Felisiak 27b07a3246
Refs #30581 -- Moved CheckConstraint tests for conditional expressions to migrations.test_operations.
This allows avoiding warning in tests about using RawSQL in
CheckConstraints.
2022-05-05 06:44:34 +02:00
David Wobrock aca9bb2a12 Fixed #33413 -- Made migrations propage collations to related fields. 2022-05-02 08:13:38 +02:00
Adam Johnson 6f453cd298 Fixed #33509 -- Added "(no-op)" to sqlmigrate output for operations without SQL statement. 2022-04-21 12:25:16 +02:00
Adam Johnson f15f7d395c Refs #33509 -- Made sqlmigrate tests stricter and improved isolation. 2022-04-21 12:21:46 +02:00
Mariusz Felisiak a65547c04a
Fixed tests on databases that don't support introspecting foreign keys. 2022-04-13 11:52:40 +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
Carlton Gibson 59ab3fd0e9 Refs #32365 -- Deprecated django.utils.timezone.utc. 2022-03-29 14:47:44 +02:00
Carlton Gibson bb61f0186d Refs #32365 -- Removed internal uses of utils.timezone.utc alias.
Remaining test case ensures that uses of the alias are mapped
canonically by the migration writer.
2022-03-24 06:29:50 +01:00
Carlton Gibson d46e158ee2 Refs #32365 -- Made migration writer use datetime.timezone.utc. 2022-03-23 12:43:43 +01:00
Adam Johnson 8f7cda0831
Fixed #33572 -- Implemented CreateModel/AlterModelManagers reduction. 2022-03-11 07:03:51 +01:00
Mariusz Felisiak d11944be34
Refs #33476 -- Added warning to optimizemigration/squashmigrations commands when black cannot be applied. 2022-02-23 07:29:15 +01:00
David Wobrock 7c318a8bdd Fixed #27844 -- Added optimizemigration management command. 2022-02-22 10:30:40 +01: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
Carlton Gibson d113b5a837 Refs #33476 -- Made management commands use black.
Run black on generated files, if it is available on PATH.
2022-02-11 12:23:26 +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
Mariusz Felisiak c5cd878382
Refs #33476 -- Refactored problematic code before reformatting by Black.
In these cases Black produces unexpected results, e.g.

def make_random_password(
    self,
    length=10,
    allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789',
):

or

cursor.execute("""
SELECT ...
""",
    [table name],
)
2022-02-03 11:20:46 +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
Mariusz Felisiak e972620ada
Fixed #33462 -- Fixed migration crash when altering type of primary key with MTI and foreign key.
This prevents duplicated operations when altering type of primary key
with MTI and foreign key. Previously, a foreign key to the base model
was added twice, once directly and once by the inheritance model.

Thanks bcail for the report.

Regression in 325d7710ce.
2022-01-27 18:51:39 +01:00
Jacob Walls 2d8232fa71 Fixed #26760 -- Added --prune option to migrate command. 2022-01-21 17:10:31 +01:00
Fabian Büchler eeff1787b0 Fixed #33449 -- Fixed makemigrations crash on models without Meta.order_with_respect_to but with _order field.
Regression in aa4acc164d.
2022-01-21 06:44:53 +01:00
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