[GH-ISSUE #889] python manage.py migrate cant migrate limits #781

Closed
opened 2026-02-27 11:13:31 +03:00 by kerem · 4 comments
Owner

Originally created by @suptimal on GitHub (Jun 9, 2016).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/889

hello its me again :( sry,

i have another modoboa instance broken, its no real issue from ur code but mby u can help me.

someone upped modoboa to version 1.5.3 and i get internal errors now as i try to access users, i tried python manage.py migrate and got:

Operations to perform:
  Apply all migrations: authtoken, core, limits, lib, sessions, admin, modoboa_postfix_autoreply, auth, sites, reversion, contenttypes, modoboa_amavis, modoboa_imap_migration, relaydomains
Running migrations:
  Rendering model states... DONE
  Applying limits.0003_auto_20160413_1046...Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 200, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 92, in migrate
    self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 121, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 198, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/migration.py", line 120, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/operations/special.py", line 183, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/usr/local/lib/python2.7/dist-packages/modoboa/limits/migrations/0003_auto_20160413_1046.py", line 40, in move_limits_to_user
    content_type=name_to_content_type[limit.name])
KeyError: u'relay_domain_aliases_limit'

and i cant say from which version and how the customer uppgraded.

any ideas pls.
thx
matthias

Originally created by @suptimal on GitHub (Jun 9, 2016). Original GitHub issue: https://github.com/modoboa/modoboa/issues/889 hello its me again :( sry, i have another modoboa instance broken, its no real issue from ur code but mby u can help me. someone upped modoboa to version 1.5.3 and i get internal errors now as i try to access users, i tried python manage.py migrate and got: ``` Operations to perform: Apply all migrations: authtoken, core, limits, lib, sessions, admin, modoboa_postfix_autoreply, auth, sites, reversion, contenttypes, modoboa_amavis, modoboa_imap_migration, relaydomains Running migrations: Rendering model states... DONE Applying limits.0003_auto_20160413_1046...Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 353, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 345, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 348, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 399, in execute output = self.handle(*args, **options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 200, in handle executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial) File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 92, in migrate self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=fake_initial) File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 121, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 198, in apply_migration state = migration.apply(state, schema_editor) File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/migration.py", line 120, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/operations/special.py", line 183, in database_forwards self.code(from_state.apps, schema_editor) File "/usr/local/lib/python2.7/dist-packages/modoboa/limits/migrations/0003_auto_20160413_1046.py", line 40, in move_limits_to_user content_type=name_to_content_type[limit.name]) KeyError: u'relay_domain_aliases_limit' ``` and i cant say from which version and how the customer uppgraded. any ideas pls. thx matthias
kerem closed this issue 2026-02-27 11:13:31 +03:00
Author
Owner

@tonioo commented on GitHub (Jun 9, 2016):

You need to clean the limits_limit table. Remove all entries with a name starting with 'relay_domain'.

<!-- gh-comment-id:224822949 --> @tonioo commented on GitHub (Jun 9, 2016): You need to clean the limits_limit table. Remove all entries with a name starting with 'relay_domain'.
Author
Owner

@suptimal commented on GitHub (Jun 9, 2016):

its not only relay_domain so i have to clean them all and it shuld work?

thx i'll try it tonight

On 09.06.2016 07:45, Antoine Nguyen wrote:

You need to clean the limits_limit table. Remove all entries with a
name starting with 'relay_domain'.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/tonioo/modoboa/issues/889#issuecomment-224822949,
or mute the thread
https://github.com/notifications/unsubscribe/AEul09rKUhnqfpj-YrTYFu3znPG693kkks5qJ8R_gaJpZM4IxheB.

<!-- gh-comment-id:224823299 --> @suptimal commented on GitHub (Jun 9, 2016): its not only relay_domain so i have to clean them all and it shuld work? thx i'll try it tonight On 09.06.2016 07:45, Antoine Nguyen wrote: > You need to clean the limits_limit table. Remove all entries with a > name starting with 'relay_domain'. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > https://github.com/tonioo/modoboa/issues/889#issuecomment-224822949, > or mute the thread > https://github.com/notifications/unsubscribe/AEul09rKUhnqfpj-YrTYFu3znPG693kkks5qJ8R_gaJpZM4IxheB.
Author
Owner

@tonioo commented on GitHub (Jun 9, 2016):

If you remove the relay_domain entries, then the migration will work as expected. You can also remove all entries but you'll lost existing limits...

<!-- gh-comment-id:224823725 --> @tonioo commented on GitHub (Jun 9, 2016): If you remove the relay_domain entries, then the migration will work as expected. You can also remove all entries but you'll lost existing limits...
Author
Owner

@suptimal commented on GitHub (Jun 10, 2016):

thx solved 50%.

for the other 50% i had to change "/usr/local/lib/python2.7/dist-packages/modoboa_amavis/modo_extension.py" line 45

replaced some code:

#domalias_pattern = "@{0}".format(domalias.name) <= replaced with next line
domalias_pattern = "@{0}".format(domalias.name.encode('utf-8'))

anyway thx for ur support and great software.

<!-- gh-comment-id:225070230 --> @suptimal commented on GitHub (Jun 10, 2016): thx solved 50%. for the other 50% i had to change "/usr/local/lib/python2.7/dist-packages/modoboa_amavis/modo_extension.py" line 45 replaced some code: ``` #domalias_pattern = "@{0}".format(domalias.name) <= replaced with next line domalias_pattern = "@{0}".format(domalias.name.encode('utf-8')) ``` anyway thx for ur support and great software.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#781
No description provided.