Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate sqlite3.OperationalError #183

Closed
jkevingutierrez opened this issue Jul 14, 2020 · 1 comment
Closed

migrate sqlite3.OperationalError #183

jkevingutierrez opened this issue Jul 14, 2020 · 1 comment

Comments

@jkevingutierrez
Copy link

jkevingutierrez commented Jul 14, 2020

Issue summary

Having a fresh wagtail installation, I'm getting an error when trying to execute python manage.py migrate

models.py:

from django.db import models

from wagtailtrans.models import TranslatablePage


class HomePage(TranslatablePage):
    pass

generated migration:

# Generated by Django 3.0.8 on 2020-07-14 17:47

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('wagtailtrans', '0009_create_initial_language'),
        ('home', '0002_create_homepage'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='homepage',
            name='page_ptr',
        ),
        migrations.AddField(
            model_name='homepage',
            name='translatablepage_ptr',
            field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailtrans.TranslatablePage'),
            preserve_default=False,
        ),
    ]

How to reproduce?

After installing wagtail (Following all the steps here https://docs.wagtail.io/en/v2.9.2/getting_started/tutorial.html just before Extend the HomePage model), proceed to install wagtailtrans following the steps here https://wagtailtrans.readthedocs.io/en/latest/getting_started.html

Try to run

$ python manage.py makemigrations
$ python manage.py migrate

Technical details

  • Python, django, wagtail and wagtailtrans version
    Python 3.7.8

Django 3.0.8
wagtail 2.9.2
wagtailtrans 2.1

Tracktrace:

Running migrations:
  Applying home.0003_auto_20200714_1747...Traceback (most recent call last):
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 396, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: near ")": syntax error

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/core/management/base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/core/management/base.py", line 369, in execute
    output = self.handle(*args, **options)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 233, in handle
    fake_initial=fake_initial,
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/migrations/executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/migrations/migration.py", line 124, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/migrations/operations/fields.py", line 178, in database_forwards
    schema_editor.remove_field(from_model, from_model._meta.get_field(self.name))
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/backends/sqlite3/schema.py", line 346, in remove_field
    self._remake_table(model, delete_field=field)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/backends/sqlite3/schema.py", line 287, in _remake_table
    self.quote_name(model._meta.db_table),
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 142, in execute
    cursor.execute(sql, params)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 100, in execute
    return super().execute(sql, params)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
  File "/Users/kegutierrez/code/tests/wagtail/venv/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 396, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: near ")": syntax error
@jkevingutierrez
Copy link
Author

Duplicated of #176

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant