jazzband / wagtailmenus

An app to help you manage and render menus in your Wagtail projects more effectively

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No migration file ! So makemigrations break

konstantinoschristomanos opened this issue · comments

Migrations for 'wagtailmenus':
/usr/local/lib/python3.9/site-packages/wagtailmenus/migrations/0024_alter_flatmenu_id_alter_flatmenuitem_id_and_more.py
- Alter field id on flatmenu
- Alter field id on flatmenuitem
- Alter field id on mainmenu
- Alter field id on mainmenuitem
Traceback (most recent call last):
File "/app/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.9/site-packages/django/core/management/init.py", line 446, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.9/site-packages/django/core/management/init.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 448, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 96, in wrapped
res = handle_func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/makemigrations.py", line 239, in handle
self.write_migration_files(changes)
File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/makemigrations.py", line 279, in write_migration_files
with open(writer.path, "w", encoding="utf-8") as fh:
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.9/site-packages/wagtailmenus/migrations/0024_alter_flatmenu_id_alter_flatmenuitem_id_and_more.py'

Hi @konstantinoschristomanos , could you please share the Django version you're using?

Hi @konstantinoschristomanos , could you please share the Django version you're using?

Sure !
Django 4.1.8

Thanks! I'm giving it a look!

Ok, the problem is likely due to having DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" in your settings.py. This is the new default since Django 3.2.

There are 2 possible fixtures (and also a workaround for you @konstantinoschristomanos).

@schlich, as a fellow maintainer, which fixture do you prefer? (o゚v゚)ノ

  1. To create a migration file that changes the AUTO_FIELD to BigAutoField. This is unlikely to break anything since Django 3.2 is already our minimal Django version
  2. To add default_auto_field = "django.db.models.AutoField" to the WagtailMenusConfig. This makes the db id for menus to be an Int and not a BigInt - which I also think is fine (it's unlikely that any menu database with more than 2,147,483,647 entries haha!)

Tell me which you prefer and I create the PR.


@konstantinoschristomanos , in the meanwhile, I see that you are trying to install wagtailmenus in your global python. Since your global python is installed globally and your user doesn't have permission to alter it, your makemigrations process is failing.

To bypass this, you could either install a local version of python or use a virtual environment in a directory your user has 'write' permission. That way you can create the missing migration files yourself.

Thank you @MrCordeiro !
I am using docker for development so its the container's global python !

Yes sure ! I can't imagine a website with more entities and since an easy default_auto_field = "django.db.models.AutoField" will do the work, then we can go with solution 2.

Thanks again for the help, I will wait for the pr !

@konstantinoschristomanos, the git version is already updated. I'll prepare the new release for Pypi this weekend.

@konstantinoschristomanos, the git version is already updated. I'll prepare the new release for Pypi this weekend.

Thank you @MrCordeiro I saw the update !
Waiting for the new release !

Wait no longer! It's been released!