#34984: One-off default migrations fail on tables with GeneratedField (on SQLite) -------------------------------+-------------------------------------- Reporter: Sarah Boyce | Owner: nobody Type: Uncategorized | Status: closed Component: Uncategorized | Version: 5.0 Severity: Normal | Resolution: worksforme Keywords: | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+--------------------------------------
Comment (by David Sanders): Thanks Sarah 🏆. Confirmed on main, full traceback: {{{ django-sample % dj migrate Operations to perform: Apply all migrations: admin, auth, contenttypes, htc, query_json_in, sessions, ticket_34984_one_off_default, union_issue Running migrations: Applying ticket_34984_one_off_default.0002_article_new_field_temporary_default...Traceback (most recent call last): File "/path/to/django/django/db/backends/utils.py", line 105, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/to/django/django/db/backends/sqlite3/base.py", line 328, in execute return super().execute(query, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sqlite3.OperationalError: cannot INSERT into generated column "slug" The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/path/to/sample-project/./manage.py", line 22, in <module> main() File "/path/to/sample-project/./manage.py", line 18, in main execute_from_command_line(sys.argv) File "/path/to/django/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/path/to/django/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/path/to/django/django/core/management/base.py", line 412, in run_from_argv self.execute(*args, **cmd_options) File "/path/to/django/django/core/management/base.py", line 458, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/to/django/django/core/management/base.py", line 106, in wrapper res = handle_func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/to/django/django/core/management/commands/migrate.py", line 356, in handle post_migrate_state = executor.migrate( ^^^^^^^^^^^^^^^^^ File "/path/to/django/django/db/migrations/executor.py", line 135, in migrate state = self._migrate_all_forwards( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/to/django/django/db/migrations/executor.py", line 167, in _migrate_all_forwards state = self.apply_migration( ^^^^^^^^^^^^^^^^^^^^^ File "/path/to/django/django/db/migrations/executor.py", line 252, in apply_migration state = migration.apply(state, schema_editor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/to/django/django/db/migrations/migration.py", line 132, in apply operation.database_forwards( File "/path/to/django/django/db/migrations/operations/fields.py", line 108, in database_forwards schema_editor.add_field( File "/path/to/django/django/db/backends/sqlite3/schema.py", line 303, in add_field self._remake_table(model, create_field=field) File "/path/to/django/django/db/backends/sqlite3/schema.py", line 233, in _remake_table self.execute( File "/path/to/django/django/db/backends/base/schema.py", line 201, in execute cursor.execute(sql, params) File "/path/to/django/django/db/backends/utils.py", line 122, in execute return super().execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/to/django/django/db/backends/utils.py", line 79, in execute return self._execute_with_wrappers( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/to/django/django/db/backends/utils.py", line 92, in _execute_with_wrappers return executor(sql, params, many, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/to/django/django/db/backends/utils.py", line 100, in _execute with self.db.wrap_database_errors: File "/path/to/django/django/db/utils.py", line 91, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/path/to/django/django/db/backends/utils.py", line 105, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/to/django/django/db/backends/sqlite3/base.py", line 328, in execute return super().execute(query, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ django.db.utils.OperationalError: cannot INSERT into generated column "slug" }}} -- Ticket URL: <https://code.djangoproject.com/ticket/34984#comment:3> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/0107018bf239ae8d-e0a1fcdc-330a-452e-a75c-584bf0b04f11-000000%40eu-central-1.amazonses.com.