G4brym / django-cf

Django database engine for Cloudflare D1 and Durable Objects
https://pypi.org/project/django-cf/
MIT License
21 stars 1 forks source link

Wagtail v6.2 migration error #3

Open xeroticikot opened 3 months ago

xeroticikot commented 3 months ago

Django==5.1, wagtail==6.2

when running "python manage.py migrate", the following error occurs -

Operations to perform:
  Apply all migrations: admin, auth, contenttypes, home, sessions, taggit, wagtailadmin, wagtailcore, wagtaildocs, wagtailembeds, wagtailforms, wagtailimages, wagtailredirects, wagtailsearch, wagtailusers
Running migrations:
  Applying wagtailcore.0020_add_index_on_page_first_published_at...Traceback (most recent call last):
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\backends\utils.py", line 105, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django_d1\database.py", line 195, in execute
    self.results = self.run_query(query, params)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django_d1\database.py", line 22, in newfn
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django_d1\database.py", line 159, in run_query
    raise DatabaseError(errorMsg)
django.db.utils.DatabaseError: internal error

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

Traceback (most recent call last):
  File "E:\WORKPLACE\AA\d1wag\manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\core\management\__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\core\management\base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\core\management\base.py", line 459, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\core\management\base.py", line 107, in wrapper
    res = handle_func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\core\management\commands\migrate.py", line 357, in handle        
    post_migrate_state = executor.migrate(
                         ^^^^^^^^^^^^^^^^^
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\migrations\executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\migrations\executor.py", line 167, in _migrate_all_forwards   
    state = self.apply_migration(
            ^^^^^^^^^^^^^^^^^^^^^
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\migrations\executor.py", line 255, in apply_migration
    state = migration.apply(state, schema_editor)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\migrations\migration.py", line 132, in apply
    operation.database_forwards(
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\migrations\operations\fields.py", line 241, in database_forwards
    schema_editor.alter_field(from_model, from_field, to_field)
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\backends\base\schema.py", line 905, in alter_field
    self._alter_field(
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\backends\sqlite3\schema.py", line 378, in _alter_field        
    self._remake_table(model, alter_fields=[(old_field, new_field)])
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\backends\sqlite3\schema.py", line 257, in _remake_table       
    self.delete_model(model, handle_autom2m=False)
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\backends\sqlite3\schema.py", line 279, in delete_model        
    self.execute(
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\backends\base\schema.py", line 202, in execute
    cursor.execute(sql, params)
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\backends\utils.py", line 122, in execute
    return super().execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\backends\utils.py", line 79, in execute
    return self._execute_with_wrappers(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\backends\utils.py", line 92, in _execute_with_wrappers        
    return executor(sql, params, many, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\backends\utils.py", line 100, in _execute
    with self.db.wrap_database_errors:
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django\db\backends\utils.py", line 105, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django_d1\database.py", line 195, in execute
    self.results = self.run_query(query, params)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django_d1\database.py", line 22, in newfn
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "E:\WORKPLACE\AA\d1env\Lib\site-packages\django_d1\database.py", line 159, in run_query
    raise DatabaseError(errorMsg)
django.db.utils.DatabaseError: internal error
G4brym commented 1 week ago

Hey @xeroticikot getting back at this issue, i was able to fully migrate and run the wagtail bakery demo application using this library django-cf in conjunction with workers-dbms that uses Durable Objects instead of D1 as the database.

The application was fast enought for me, but let me know what you think Learn how to use workers-dbms here