{"action":"created","issue":{"url":"https://api.github.com/repos/modoboa/modoboa-admin-relaydomains/issues/7","labels_url":"https://api.github.com/repos/modoboa/modoboa-admin-relaydomains/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/modoboa/modoboa-admin-relaydomains/issues/7/comments","events_url":"https://api.github.com/repos/modoboa/modoboa-admin-relaydomains/issues/7/events","html_url":"https://github.com/modoboa/modoboa-admin-relaydomains/issues/7","id":115473379,"number":7,"title":"Migration from 1.2 to relaydomains-1.1 fails","user":{"login":"andrewyager","id":1388416,"avatar_url":"https://avatars.githubusercontent.com/u/1388416?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewyager","html_url":"https://github.com/andrewyager","followers_url":"https://api.github.com/users/andrewyager/followers","following_url":"https://api.github.com/users/andrewyager/following{/other_user}","gists_url":"https://api.github.com/users/andrewyager/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewyager/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewyager/subscriptions","organizations_url":"https://api.github.com/users/andrewyager/orgs","repos_url":"https://api.github.com/users/andrewyager/repos","events_url":"https://api.github.com/users/andrewyager/events{/privacy}","received_events_url":"https://api.github.com/users/andrewyager/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-06T09:56:58Z","updated_at":"2015-11-08T13:47:19Z","closed_at":null,"body":"I'm having lots of issues migrating from 1.2 to relaydomains-1.1.\r\n\r\nMost notably, the migration fails at step 0004:\r\n\r\n```\r\n  Applying modoboa_admin_relaydomains.0004_auto_20150506_1609...Traceback (most recent call last):\r\n  File \"manage.py\", line 10, in <module>\r\n    execute_from_command_line(sys.argv)\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/core/management/__init__.py\", line 385, in execute_from_command_line\r\n    utility.execute()\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/core/management/__init__.py\", line 377, in execute\r\n    self.fetch_command(subcommand).run_from_argv(self.argv)\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/core/management/base.py\", line 288, in run_from_argv\r\n    self.execute(*args, **options.__dict__)\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/core/management/base.py\", line 338, in execute\r\n    output = self.handle(*args, **options)\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py\", line 161, in handle\r\n    executor.migrate(targets, plan, fake=options.get(\"fake\", False))\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/db/migrations/executor.py\", line 68, in migrate\r\n    self.apply_migration(migration, fake=fake)\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/db/migrations/executor.py\", line 102, in apply_migration\r\n    migration.apply(project_state, schema_editor)\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/db/migrations/migration.py\", line 108, in apply\r\n    operation.database_forwards(self.app_label, schema_editor, project_state, new_state)\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/db/migrations/operations/fields.py\", line 139, in database_forwards\r\n    schema_editor.alter_field(from_model, from_field, to_field)\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/db/backends/schema.py\", line 470, in alter_field\r\n    self._alter_field(model, old_field, new_field, old_type, new_type, old_db_params, new_db_params, strict)\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/db/backends/schema.py\", line 615, in _alter_field\r\n    params,\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/db/backends/schema.py\", line 111, in execute\r\n    cursor.execute(sql, params)\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/db/backends/utils.py\", line 65, in execute\r\n    return self.cursor.execute(sql, params)\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/db/utils.py\", line 94, in __exit__\r\n    six.reraise(dj_exc_type, dj_exc_value, traceback)\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/db/backends/utils.py\", line 65, in execute\r\n    return self.cursor.execute(sql, params)\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py\", line 129, in execute\r\n    return self.cursor.execute(query, args)\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/MySQLdb/cursors.py\", line 205, in execute\r\n    self.errorhandler(self, exc, value)\r\n  File \"/opt/spamcloud-gui/local/lib/python2.7/site-packages/MySQLdb/connections.py\", line 36, in defaulterrorhandler\r\n    raise errorclass, errorvalue\r\ndjango.db.utils.IntegrityError: (1062, \"Duplicate entry '0' for key 'domain_id'\")\r\n```\r\n\r\nFrom what I can tell this is failing on the final step of the migration where it is altering the table and migrating the domains from the relay_domain table to the domain table. I've been attempting to work around this for a little while but I'm not seeing an easy way to modify this migration to get around this? Any suggestions?"},"comment":{"url":"https://api.github.com/repos/modoboa/modoboa-admin-relaydomains/issues/comments/154827303","html_url":"https://github.com/modoboa/modoboa-admin-relaydomains/issues/7#issuecomment-154827303","issue_url":"https://api.github.com/repos/modoboa/modoboa-admin-relaydomains/issues/7","id":154827303,"user":{"login":"tonioo","id":531694,"avatar_url":"https://avatars.githubusercontent.com/u/531694?v=3","gravatar_id":"","url":"https://api.github.com/users/tonioo","html_url":"https://github.com/tonioo","followers_url":"https://api.github.com/users/tonioo/followers","following_url":"https://api.github.com/users/tonioo/following{/other_user}","gists_url":"https://api.github.com/users/tonioo/gists{/gist_id}","starred_url":"https://api.github.com/users/tonioo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonioo/subscriptions","organizations_url":"https://api.github.com/users/tonioo/orgs","repos_url":"https://api.github.com/users/tonioo/repos","events_url":"https://api.github.com/users/tonioo/events{/privacy}","received_events_url":"https://api.github.com/users/tonioo/received_events","type":"User","site_admin":false},"created_at":"2015-11-08T13:47:19Z","updated_at":"2015-11-08T13:47:19Z","body":"Yes, once the migration fails. Indeed, the name column is dropped but a the domain_id one is added and filled by the 0003 migration, so the one just before 0004."}}