summaryrefslogtreecommitdiff
path: root/django/db/backends/mysql/schema.py
Commit message (Collapse)AuthorAgeFilesLines
* Fixed #470 -- Added support for database defaults on fields.Ian Foote2023-05-121-5/+24
| | | | | | | | Special thanks to Hannes Ljungberg for finding multiple implementation gaps. Thanks also to Simon Charette, Adam Johnson, and Mariusz Felisiak for reviews.
* Fixed #34553 -- Fixed improper % escaping of literal in constraints.Simon Charette2023-05-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Proper escaping of % in string literals used when defining constaints was attempted (a8b3f96f6) by overriding quote_value of Postgres and Oracle schema editor. The same approach was used when adding support for constraints to the MySQL/MariaDB backend (1fc2c70). Later on it was discovered that this approach was not appropriate and that a preferable one was to pass params=None when executing the constraint creation DDL to avoid any form of interpolation in the first place (42e8cf47). When the second patch was applied the corrective of the first were not removed which caused % literals to be unnecessary doubled. This flew under the radar because the existings test were crafted in a way that consecutive %% didn't catch regressions. This commit introduces an extra test for __exact lookups which highlights more adequately % doubling problems but also adjust a previous __endswith test to cover % doubling problems (%\% -> %%\%%). Thanks Thomas Kolar for the report. Refs #32369, #30408, #30593.
* Refs #34320 -- Stopped recreating check constraints when renaming fields.Mariusz Felisiak2023-03-021-0/+13
| | | | | This also fixes test_rename_field_with_check_to_truncated_name() on MariaDB 10.5.2+ as ALTER TABLE ... RENAME COLUMN statement doesn't rename inline constraints.
* Refs #33476 -- Applied Black's 2023 stable style.David Smith2023-02-011-1/+0
| | | | | | | | Black 23.1.0 is released which, as the first release of the year, introduces the 2023 stable style. This incorporates most of last year's preview style. https://github.com/psf/black/releases/tag/23.1.0
* Fixed #34304 -- Made MySQL's SchemaEditor.remove_constraint() don't create ↵sag᠎e2023-01-311-1/+4
| | | | | foreign key index when unique constraint is ignored. Regression in b731e8841558ee4caaba766c83f34ea9c7004f8b.
* Fixed #18468 -- Added support for comments on columns and tables.kimsoungryoul2022-12-281-1/+12
| | | | | | | | Thanks Jared Chung, Tom Carrick, David Smith, Nick Pope, and Mariusz Felisiak for reviews. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com> Co-authored-by: Nick Pope <nick@nickpope.me.uk>
* Fixed #34219 -- Preserved Char/TextField.db_collation when altering column type.Mariusz Felisiak2022-12-221-4/+7
| | | | | | | This moves setting a database collation to the column type alteration as both must be set at the same time. This should also avoid another layer of the column type alteration when adding database comments support (#18468).
* Fixed #31335 -- Fixed removing composed composed Meta constraints/indexes on ↵Sergey Fursov2022-09-131-7/+48
| | | | foreign keys on MySQL.
* Refs #31335 -- Added SchemaEditor._create_missing_fk_index() on MySQL.Sergey Fursov2022-09-121-6/+17
|
* Refs #27064 -- Added RenameIndex migration operation.David Wobrock2022-05-121-0/+1
|
* Refs #33476 -- Reformatted code with Black.django-bot2022-02-071-25/+40
|
* Updated various links to HTTPS and new locations.Mariusz Felisiak2021-12-021-1/+1
| | | | Co-Authored-By: Nick Pope <nick@nickpope.me.uk>
* Fixed #33129 -- Dropped support for MariaDB 10.2.Mariusz Felisiak2021-09-221-3/+2
|
* Optimized DatabaseSchemaEditor._field_should_be_indexed() on MySQL.Matjaz Gregoric2021-08-201-3/+4
|
* Fixed #32503 -- Fixed altering BLOB/TEXT field to non-nullable with default ↵Yuekui Li2021-05-211-0/+7
| | | | | | | | | | | on MySQL 8.0.13+. MySQL 8.0.13+ supports defaults for BLOB/TEXT but not in the ALTER COLUMN statement. Regression in 6b16c91157512587017e9178d066ed1a683e7795. Thanks Matt Westcott for the report.
* Fixed #32425 -- Fixed adding nullable field with default on MySQL.Jordan Bae2021-02-091-0/+1
| | | | Thanks Simon Charette for the review.
* Refs #26167 -- Made DatabaseSchemaEditor._create_index_sql()'s fields ↵Hannes Ljungberg2020-12-231-1/+3
| | | | argument optional and kwarg-only.
* Fixed #31777 -- Added support for database collations to Char/TextFields.Tom Carrick2020-09-211-0/+1
| | | | Thanks Simon Charette and Mariusz Felisiak for reviews.
* Refs #31411 -- Used RENAME COLUMN on MySQL 8.0.4+.Mariusz Felisiak2020-04-091-1/+6
| | | | | | MySQL 8.0.3 added support for this syntax but also imposed a restriction against ALTER TABLE RENAME on tables in a foreign key relationship if a LOCK TABLES was active which has been lifted in MySQL 8.0.4+.
* Fixed #31411 -- Used RENAME COLUMN on MariaDB 10.5.2+.Hasan Ramezani2020-04-021-2/+6
|
* Fixed #30750 -- Added support for check constraints on MySQL 8.0.16+.Mariusz Felisiak2019-09-051-4/+9
|
* Fixed #30712 -- Allowed BLOB/TEXT defaults on MySQL 8.0.13+.Nasir Hussain2019-08-221-2/+14
|
* Fixed #27676 -- Allowed BLOB/TEXT defaults on MariaDB 10.2.1+.Adam Johnson2019-08-161-1/+10
|
* Fixed #30593 -- Added support for check constraints on MariaDB 10.2+.Hasan Ramezani2019-07-191-0/+6
|
* Fixed #30380 -- Handled bytes in MySQL backend for PyMySQL support.Mariusz Felisiak2019-04-191-1/+2
| | | This commit partly reverts efd8a82e268a82b3ad0be77bd5b4548c30bcb4d7.
* Fixed #30108 -- Allowed adding foreign key constraints in the same statement ↵Dan Tao2019-01-291-1/+4
| | | | that adds a field.
* Fixed #29547 -- Added support for partial indexes.Mads Jensen2018-10-291-0/+2
| | | | | Thanks to Ian Foote, Mariusz Felisiak, Simon Charettes, and Markus Holtermann for comments and feedback.
* Fixed #29103 -- Removed bad 'b'-prefix added by MySQL's ↵Claude Paroz2018-03-171-3/+5
| | | | SchemaEditor.quote_value().
* Fixed #28982 -- Simplified code with and/or.Дилян Палаузов2018-01-031-3/+1
|
* Fixed #28275 -- Added more hooks to SchemaEditor._alter_field().Florian Apolloner2017-06-061-2/+2
|
* Fixed #27859 -- Ignored db_index for TextField/BinaryField on Oracle and MySQL.Mariusz Felisiak2017-05-231-13/+7
| | | Thanks Zubair Alam for the initial patch and Tim Graham for the review.
* Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand2017-01-251-5/+5
|
* Fixed #27441 -- Improved SQL for 'DROP COLUMN' on MySQLAdam Chainz2016-11-051-0/+4
| | | 'CASCADE' is an undocumented no-op in MySQL, so to avoid confusion Django no longer outputs it.
* Fixed #26966 -- Made MySQL backend skip defaults for JSON columnsAdam Chainz2016-08-011-2/+3
| | | Thanks mcgeeco for reporting, and claudep and timgraham for review.
* Fixed #26171 -- Made MySQL create an index on ForeignKeys with ↵Aaron Elliot Ross2016-06-281-8/+11
| | | | | | db_contraint=False. Refactored "Prevented unneeded index creation on MySQL-InnoDB" (2ceb10f) to avoid setting db_index=False.
* Fixed #26593 -- Leveraged deferrable_sql() in SchemaEditorMarkus Holtermann2016-05-071-4/+0
|
* Removed unused attributes of MySQL SchemaEditor.Tim Graham2016-01-221-3/+0
|
* Fixed #25393 -- Fixed MySQL crash when adding text/blob field with ↵Ville Skyttä2015-09-141-1/+2
| | | | unhashable default.
* Fixed #24972 -- Fixed removing unique_together indexes on MySQL.Adam Brenecki2015-06-151-4/+2
|
* Fixed #24846 -- Added support to MySQL SchemaEditor for all blob/text data typesAdam Chainz2015-05-301-3/+10
|
* Fixed #24817 -- Prevented loss of null info in MySQL field renaming.Andriy Sokolovskiy2015-05-281-3/+14
|
* Fixed #24757 -- Recreated MySQL index when needed during combined index removalClaude Paroz2015-05-151-0/+18
| | | | | Thanks Thomas Recouvreux for the report and Tim Graham for the tests and review.
* Fixed #24595 -- Prevented loss of null info in MySQL field alterationClaude Paroz2015-04-171-0/+8
| | | | | Thanks Simon Percivall for the report, and Simon Charette and Tim Graham for the reviews.
* Removed duplicate attribute in MySQL DatabaseSchemaEditor.Andriy Sokolovskiy2015-03-301-2/+0
|
* Fixed #22603 -- Reorganized classes in django.db.backends.Tim Graham2015-01-141-1/+1
|
* Fixed #14180 -- Prevented unneeded index creation on MySQL-InnoDBClaude Paroz2014-12-271-0/+12
| | | | | Thanks zimnyx for the report and Simon Charette, Tim Graham for the reviews.
* Limited lines to 119 characters in django/Tim Graham2014-09-051-1/+4
| | | | refs #23395.
* Fixed unused import.Loic Bistuer2014-05-211-1/+0
|
* Fixed #22649: Beefed up quote_valueAndrew Godwin2014-05-201-8/+3
|
* Fixed #22424 -- Fixed handling of default values for TextField/BinaryField ↵Loic Bistuer2014-05-181-1/+26
| | | | | | on MySQL. Thanks syphar for the review and suggestions.