summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3/schema.py
AgeCommit message (Collapse)Author
2025-10-18Fixed #36671 -- Dropped support for SQLite < 3.37.Mariusz Felisiak
2025-10-18Fixed #21961 -- Added support for database-level delete options for ForeignKey.Mariusz Felisiak
Thanks Simon Charette for pair programming. Co-authored-by: Nick Stefan <NickStefan12@gmail.com> Co-authored-by: Akash Kumar Sen <71623442+Akash-Kumar-Sen@users.noreply.github.com> Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-09-22Fixed #35453 -- Made ManyToManyField.concrete False.Ryan P Kilby
ManyToManyField was already excluded from fields, concrete_fields, and local_concrete_fields in Options.
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2025-03-09Fixed #35487 -- Removed CASCADE from RemoveField() on PostgreSQL.petr.prikryl
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com> Co-authored-by: Adam Johnson <me@adamj.eu> Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2025-01-10Refs #36064 -- Added Model.has_db_default() to encapsulate NOT_PROVIDED checks.Simon Charette
This avoids many awkward checks against NOT_PROVIDED and provides symmetry with Field.has_default() which is also the reason why it wasn't made a property.
2024-11-29Fixed #373 -- Added CompositePrimaryKey.Bendeguz Csirmaz
Thanks Lily Foote and Simon Charette for reviews and mentoring this Google Summer of Code 2024 project. Co-authored-by: Simon Charette <charette.s@gmail.com> Co-authored-by: Lily Foote <code@lilyf.org>
2024-04-16Fixed #35373 -- Fixed a crash when indexing a generated field on SQLite.Simon Charette
Generated fields have to be excluded from the INSERT query against the remade table including the index. Thanks Moshe Dicker for the report, David Sanders and Mariusz Felisiak for the review.
2024-03-14Fixed #28541 -- Fixed migrations crash when changing primary key on SQLite.Ben Cail
2023-11-30Fixed #35006 -- Fixed migrations crash when altering Meta.db_table_comment ↵Mariusz Felisiak
on SQLite. Thanks Юрий for the report. Regression in 78f163a4fb3937aca2e71786fbdd51a0ef39629e.
2023-11-22Fixed #34984 -- Skipped GeneratedFields when remaking tables on SQLite.Sarah Boyce
Regression in f333e3513e8bdf5ffeb6eeb63021c230082e6f95.t Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com> Co-authored-by: David Sanders <shang.xiao.sanders@gmail.com>
2023-09-18Refs #27236 -- Removed Meta.index_together per deprecation timeline.Mariusz Felisiak
2023-09-07Fixed #31300 -- Added GeneratedField model field.Jeremy Nauta
Thanks Adam Johnson and Paolo Melchiorre for reviews. Co-Authored-By: Lily Foote <code@lilyf.org> Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2023-08-04Fixed #34760 -- Dropped support for SQLite < 3.27.Mariusz Felisiak
2023-05-12Fixed #470 -- Added support for database defaults on fields.Ian Foote
Special thanks to Hannes Ljungberg for finding multiple implementation gaps. Thanks also to Simon Charette, Adam Johnson, and Mariusz Felisiak for reviews.
2023-05-09Moved SQLite DatabaseSchemaEditor.add_field()'s comment to the correct line.Mariusz Felisiak
2023-05-05Refs #27236 -- Made more cosmetic edits to Meta.index_together deprecation.Mariusz Felisiak
2023-02-01Refs #33476 -- Applied Black's 2023 stable style.David Smith
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
2022-11-17Fixed #28987 -- Fixed altering ManyToManyField when changing to ↵DevilsAutumn
self-referential.
2022-11-04Fixed #34138 -- Avoided table rebuild when adding inline m2m fields on SQLite.Mariusz Felisiak
Regression in 2f73e5406d54cb8945e187eff302a3a3373350be. Thanks David Wobrock for the report.
2022-08-08Fixed #33899 -- Fixed migration crash when removing indexed field on SQLite ↵Fiza Ashraf
3.35.5+. Regression in 702819227fd0cdd9b581cd99e11d1561d51cbeb. Thanks cessor for the report.
2022-05-02Fixed #33413 -- Made migrations propage collations to related fields.David Wobrock
2022-04-29Fixed #33670 -- Fixed altering primary key on SQLite.Mariusz Felisiak
2022-02-11Refs #32502 -- Avoided table rebuild when removing fields on SQLite 3.35.5+.Mariusz Felisiak
ALTER TABLE ... DROP COLUMN was introduced in SQLite 3.35+ however a data corruption issue was fixed in SQLite 3.35.5.
2022-02-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2022-01-04Fixed #33408 -- Fixed adding nullable unique fields on SQLite.Mariusz Felisiak
Regression in 2f73e5406d54cb8945e187eff302a3a3373350be. Thanks Alan Crosswell for the report.
2021-12-10Refs #32502 -- Avoided table rebuild when adding fields with no default on ↵Mariusz Felisiak
SQLite.
2021-12-10Refs #32502 -- Added SchemaEditor.prepare_default() on SQLite.Mariusz Felisiak
2021-11-15Refs #33288 -- Removed SQLite's ↵Simon Charette
DatabaseIntrospection._get_foreign_key_constraints(). The get_relations() method returns the exact same data in a more generic format.
2021-07-27Fixed #32962 -- Consolidated string concatenations in ↵Chris Jerdonek
BaseDatabaseSchemaEditor.column_sql().
2021-05-25Fixed #32780 -- Made Add/RemoveConstraint operations a noop for ↵Hannes Ljungberg
covering/deferrable unique constraints on SQLite.
2021-02-23Fixed #30916 -- Added support for functional unique constraints.Hannes Ljungberg
Thanks Ian Foote and Mariusz Felisiak for reviews.
2020-09-21Fixed #31777 -- Added support for database collations to Char/TextFields.Tom Carrick
Thanks Simon Charette and Mariusz Felisiak for reviews.
2020-08-13Fixed #31825 -- Made RenameField operation a noop for fields with db_column.Iuri de Silvio
2020-04-21Refs #30591 -- Adjusted table rebuild for non-pk relationship on SQLite.Simon Charette
The existing code was only accounting for primary key changes and not all unique key fields that can be referenced.
2020-04-21Fixed #31064 -- Recreated auto-created many-to-many tables on primary key ↵Simon Charette
data type change on SQLite. Both local and remote auto-created many-to-many relationships were affected.
2020-04-20Stopped rebuilding referenced tables multiple times on SQLite alterations.Simon Charette
2020-02-04Simplified imports from django.db and django.contrib.gis.db.Nick Pope
2019-08-01Fixed #30664 -- Fixed migrations crash when altering table on SQLite or ↵Ngalim Siregar
altering AutoField/BigAutoField on PostgreSQL for models with quoted db_table.
2019-01-12Fixed #30062 -- Added support for unique conditional constraints.Paveł Tyślacki
2019-01-01Fixed #30060 -- Moved SQL generation for indexes and constraints to ↵Paveł Tyślacki
SchemaEditor.
2018-12-22Refs #30033 -- Checked constraints before committing SQLite schema changes.Simon Charette
This order of operations is more in line with SQLite's documented table rebuild procedure and ensures that changes aren't committed if foreign key integrity is broken.
2018-12-22Renamed SQLite3 references to to SQLite.Simon Charette
The version suffix isn't part of the product name.
2018-12-17Refs #29182 -- Stopped relying on legacy alter table semantic on SQLite 3.26+.Simon Charette
SQLite 3.26 changed the behavior of table and column renaming operations to repoint foreign key references even if foreign key checks are disabled. This makes the workarounds in place to simulate this behavior unnecessary on SQLite 3.26+. Refs #30033.
2018-12-17Fixed #30033 -- Conformed to the recommended table alterations procedure on ↵Simon Charette
SQlite3. Refs #29182. The previous implementation was following a procedure explicitly documented as incorrect and was the origin of the breakage experienced on SQLite 3.26 release that were addressed by c8ffdbe514b55ff5c9a2b8cb8bbdf2d3978c188f. Thanks to Richard Hipp for pointing out the usage of the incorrect procedure.
2018-12-15Fixed #30023 -- Prevented SQLite schema alterations while foreign key checks ↵Simon Charette
are enabled. Prior to this change foreign key constraint references could be left pointing at tables dropped during operations simulating unsupported table alterations because of an unexpected failure to disable foreign key constraint checks. SQLite3 does not allow disabling such checks while in a transaction so they must be disabled beforehand. Thanks ezaquarii for the report and Carlton and Tim for the review.
2018-12-07Fixed #29182 -- Fixed schema table alteration on SQLite 3.26+.Simon Charette
SQLite 3.26 repoints foreign key constraints on table renames even when foreign_keys pragma is off which breaks every operation that requires a table rebuild to simulate unsupported ALTER TABLE statements. The newly introduced legacy_alter_table pragma disables this behavior and restores the previous schema editor assumptions. Thanks Florian Apolloner, Christoph Trassl, Chris Lamb for the report and troubleshooting assistance.
2018-11-13Refs #29641 -- Refactored database schema constraint creation.Simon Charette
Added a test for constraint names in the database. Updated SQLite introspection to use sqlparse to allow reading the constraint name for table check and unique constraints. Co-authored-by: Ian Foote <python@ian.feete.org>
2018-10-29Fixed #29868 -- Retained database constraints on SQLite table rebuilds.Simon Charette
Refs #11964. Thanks Scott Stevens for testing this upcoming feature and the report.