Saleor: Warehouse slug migration failing

Created on 7 May 2020  路  3Comments  路  Source: mirumee/saleor

Hey guys,

Congratulations on the upcoming 2.10 release!

Any tip on why would this migration fail?

 Applying warehouse.0003_warehouse_slug...Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/timur/Code/pyenv/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/Users/timur/Code/pyenv/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/timur/Code/pyenv/lib/python3.8/site-packages/django/core/management/base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/timur/Code/pyenv/lib/python3.8/site-packages/django/core/management/base.py", line 369, in execute
    output = self.handle(*args, **options)
  File "/Users/timur/Code/pyenv/lib/python3.8/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/Users/timur/Code/pyenv/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 231, in handle
    post_migrate_state = executor.migrate(
  File "/Users/timur/Code/pyenv/lib/python3.8/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/timur/Code/pyenv/lib/python3.8/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/timur/Code/pyenv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/Users/timur/Code/pyenv/lib/python3.8/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/timur/Code/pyenv/lib/python3.8/site-packages/django/db/migrations/operations/special.py", line 190, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/Users/timur/Code/saleor/saleor/warehouse/migrations/0003_warehouse_slug.py", line 17, in create_unique_slug_for_warehouses
    first_char = warehouse.name[0].lower()
IndexError: string index out of range
bug

All 3 comments

Seems like you have a Warehouse instance without a name. Quick fix would be to filter such warehouses in Django shell and set some names (or do that in the dashboard). And we have to fix the migration anyway.

To me it looks like our own initial migration creates warehouses with empty attributes.

@timuric I've merged a PR that fixes this migration. You can check it out if you're using Saleor master branch. Otherwise, it will be released in a next version (either stable 2.10 or a release candidate rc.3)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

khalibloo picture khalibloo  路  4Comments

ranjanprj picture ranjanprj  路  3Comments

gComet picture gComet  路  3Comments

Pacu2 picture Pacu2  路  4Comments

tanvirraj picture tanvirraj  路  3Comments