summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3/schema.py
AgeCommit message (Collapse)Author
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.
2018-10-27Fixed #29763 -- Added support for column renaming on SQLite.Hampus Dunström
2018-07-10Fixed #11964 -- Added support for database check constraints.Ian Foote
2017-12-22Fixed #28884 -- Fixed crash on SQLite when renaming a field in a model ↵Simon Charette
referenced by a ManyToManyField. Introspected database constraints instead of relying on _meta.related_objects to determine whether or not a table or a column is referenced on rename operations. This has the side effect of ignoring both db_constraint=False and virtual fields such as GenericRelation which aren't backend by database level constraints and thus shouldn't prevent the rename operations from being performed in a transaction. Regression in 095c1aaa898bed40568009db836aa8434f1b983d. Thanks Tim for the additional tests and edits, and Mariusz for the review.
2017-12-01Fixed #28849 -- Fixed referenced table and column rename on SQLite.Simon Charette
Thanks Ramiro for the input and Tim for the review.
2017-11-28Fixed #28854 -- Replaced type(True) with bool in sqlite's SchemaEditor.Дилян Палаузов
2017-11-23Used bytes.hex() and bytes.fromhex() to simplify.Sergey Fedoseev
2017-07-11Fixed #14204 -- Enforced SQLite foreign key constraints.Claude Paroz
Thanks Tim Graham for contributing to the patch and Simon Charette for advice and review.
2017-06-21Refs #25530 -- Deleted deferred SQL references on delete operation.Simon Charette
2017-06-21Refs #25530 -- Tracked references of deferred SQL statements.Simon Charette
2017-06-01Refs #23968 -- Removed unnecessary lists, generators, and tuple calls.Jon Dufresne
2017-02-28Refs #27656 -- Updated django.db docstring verbs according to PEP 257.Anton Samarchyan
2017-01-25Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand
2017-01-18Refs #23919 -- Removed six.<various>_types usageClaude Paroz
Thanks Tim Graham and Simon Charette for the reviews.
2016-08-05Fixed #26808 -- Added Meta.indexes for class-based indexes.Akshesh
* Added the index name to its deconstruction. * Added indexes to sqlite3.schema._remake_table() so that indexes aren't dropped when _remake_table() is called. Thanks timgraham & MarkusH for review and advice.
2016-07-18Removed unnecessary looping in sqlite3 SchemaEditor.akki
2016-07-06Fixed #26841 -- Avoid remake tables for altering togethers in sqlite3 (#6888)akki
alter_index_together and alter_unique_together no more use _remake_table method in sqlite3
2016-05-17Fixed #26613 -- Made sqlite3 optional in SchemaEditor.quote_value().Philip Liberato
2016-03-29Fixed #26384 -- Fixed renaming the PK on a model with a self-referential FK ↵Alex Hill
on SQLite.
2015-07-15Fixed #25128 -- Fixed SQLite SchemaEditor crash when adding a ForeignObject ↵Tim Graham
field.
2015-06-06Imported sqlite3 instead of _sqlite3Sagar Mittal
adapt and ProgrammingError are both available on the sqlite3 module. There's no need to import the internal _sqlite3 module.
2015-05-04Allowed using the sqlite3 backend as much as possible without _sqlite3.Milan Broum
The inner import was dropped during the reorganizing of the database backends in commit 28308078f397d1de36fd0da417ac7da2544ba12d.
2015-04-03Cleaned up use of context manager in SQLite schema editorAlex Hill
2015-03-25Renamed Field.rel attribute to remote_fieldAnssi Kääriäinen
Field.rel is now deprecated. Rel objects have now also remote_field attribute. This means that self == self.remote_field.remote_field. In addition, made the Rel objects a bit more like Field objects. Still, marked ManyToManyFields as null=True.
2015-03-23Fixed #12400 -- Allowed geometry fields in unique_togetherClaude Paroz
Thanks Tim Graham for the review.
2015-03-21Explicitly disable FK constraints in SQLite editorAlex Hill
2015-03-21Safer table alterations under SQLiteAlex Hill
Table alterations in SQLite require creating a new table and copying data over from the old one. This change ensures that no Django model ever exists with the temporary table name as its db_table attribute.
2015-02-11Fixed isort import that's inconsistent between platforms.Loic Bistuer
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2015-01-22Fixed #24104 -- Fixed check to look on field.many_to_many instead of class ↵Andriy Sokolovskiy
instance
2015-01-14Fixed #22603 -- Reorganized classes in django.db.backends.Tim Graham
2015-01-06Fixed #12663 -- Formalized the Model._meta API for retrieving fields.Daniel Pyrathon
Thanks to Russell Keith-Magee for mentoring this Google Summer of Code 2014 project and everyone else who helped with the patch!
2014-12-15Fixed #23987 -- Made SQLite SchemaEditor always use effective_default().Andriy Sokolovskiy
2014-12-08Fixed #23968 -- Replaced list comprehension with generators and dict ↵Jon Dufresne
comprehension