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

No migration file ! So makemigrations break #452

Closed
konstantinoschristomanos opened this issue May 6, 2023 · 8 comments · Fixed by #453
Closed

No migration file ! So makemigrations break #452

konstantinoschristomanos opened this issue May 6, 2023 · 8 comments · Fixed by #453

Comments

@konstantinoschristomanos

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'

@MrCordeiro
Copy link
Contributor

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

@konstantinoschristomanos
Copy link
Author

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

Sure !
Django 4.1.8

@MrCordeiro
Copy link
Contributor

Thanks! I'm giving it a look!

@MrCordeiro
Copy link
Contributor

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.

@konstantinoschristomanos
Copy link
Author

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 !

@MrCordeiro
Copy link
Contributor

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

@konstantinoschristomanos
Copy link
Author

@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 !

@MrCordeiro
Copy link
Contributor

Wait no longer! It's been released!

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

Successfully merging a pull request may close this issue.

2 participants