#33960 closed Bug (fixed)
migrate command crashes on SQLite < 3.20.
Reported by: | Aristotelis Mikropoulos | Owned by: | Mariusz Felisiak |
---|---|---|---|
Component: | Core (Management commands) | Version: | 4.1 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Creating a fresh project and app in a fresh virtual environment, then adding the app in INSTALLED_APPS
(either bare name, or appname.apps.AppnameConfig
), and then running python manage.py migrate
causes:
$ python manage.py migrate Operations to perform: Apply all migrations: admin, auth, contenttypes, sessions Running migrations: Applying auth.0001_initial...Traceback (most recent call last): File "manage.py", line 22, in <module> main() File "manage.py", line 18, in main execute_from_command_line(sys.argv) File "/home/indy/Desktop/env/lib/python3.8/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line utility.execute() File "/home/indy/Desktop/env/lib/python3.8/site-packages/django/core/management/__init__.py", line 440, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/indy/Desktop/env/lib/python3.8/site-packages/django/core/management/base.py", line 402, in run_from_argv self.execute(*args, **cmd_options) File "/home/indy/Desktop/env/lib/python3.8/site-packages/django/core/management/base.py", line 448, in execute output = self.handle(*args, **options) File "/home/indy/Desktop/env/lib/python3.8/site-packages/django/core/management/base.py", line 96, in wrapped res = handle_func(*args, **kwargs) File "/home/indy/Desktop/env/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 349, in handle post_migrate_state = executor.migrate( File "/home/indy/Desktop/env/lib/python3.8/site-packages/django/db/migrations/executor.py", line 135, in migrate state = self._migrate_all_forwards( File "/home/indy/Desktop/env/lib/python3.8/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards state = self.apply_migration( File "/home/indy/Desktop/env/lib/python3.8/site-packages/django/db/migrations/executor.py", line 255, in apply_migration migration_recorded = True File "/home/indy/Desktop/env/lib/python3.8/site-packages/django/db/backends/sqlite3/schema.py", line 39, in __exit__ self.connection.check_constraints() File "/home/indy/Desktop/env/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 289, in check_constraints for column_name, ( ValueError: too many values to unpack (expected 2)
relations
referenced in lines 289-292 of db/backends/sqlite3/base.py
for column_name, ( referenced_column_name, referenced_table_name, ) in relations:
contains {'permission_id': ('id', 'auth_permission'), 'group_id': ('id', 'auth_group')}
, so it makes sense to cause the ValueError
.
Ubuntu 16.04
Python 3.8
Django 4.1
I don't change any settings (so, sqlite3), don't define any models, don't do any other changes.
Change History (5)
comment:1 by , 2 years ago
Owner: | changed from | to
---|---|
Severity: | Normal → Release blocker |
Status: | new → assigned |
Summary: | `python manage.py migrate` causes `ValueError: too many values to unpack (expected 2)` → migrate command crashes on SQLite < 3.20. |
Triage Stage: | Unreviewed → Accepted |
Thanks for the report! Regression in 0b95a96ee10d3e12aef01d449467bcf4641286b4.