macropin/django-registration

Migrate failed when apply "0003_migrate_activatedstatus" on MySQL

Surgo opened this issue · 0 comments

Surgo commented

1146, "Table 'default.registration_registrationprofile' doesn't exist is occured.

Why table name is default.registration_registrationprofile?

  Applying registration.0001_initial...DEBUG	2017-05-27 11:55:27,655	CREATE TABLE `registration_registrationprofile` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `activation_key` varchar(40) NOT NULL, `user_id` varchar(8) NOT NULL UNIQUE) ROW_FORMAT=DYNAMIC; (params None)
DEBUG	2017-05-27 11:55:27,707	ALTER TABLE `registration_registrationprofile` ADD CONSTRAINT `registration_registrationpr_user_id_5fcbf725_fk_accounts_user_id` FOREIGN KEY (`user_id`) REFERENCES `accounts_user` (`id`); (params [])
 OK (0.311s)
  Applying registration.0002_registrationprofile_activated...DEBUG	2017-05-27 11:55:28,059	ALTER TABLE `registration_registrationprofile` ADD COLUMN `activated` bool DEFAULT %s NOT NULL; (params [False])
DEBUG	2017-05-27 11:55:28,144	ALTER TABLE `registration_registrationprofile` ALTER COLUMN `activated` DROP DEFAULT; (params [])
 OK (0.304s)
  Applying registration.0003_migrate_activatedstatus...Traceback (most recent call last):
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 110, in execute
    return self.cursor.execute(query, args)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/cursors.py", line 166, in execute
    result = self._query(query)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/connections.py", line 856, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/connections.py", line 1057, in _read_query_result
    result.read()
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/connections.py", line 1340, in read
    first_packet = self.connection._read_packet()
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/connections.py", line 1014, in _read_packet
    packet.check_error()
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/connections.py", line 393, in check_error
    err.raise_mysql_exception(self._data)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1146, "Table 'default.registration_registrationprofile' doesn't exist")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "manage.py", line 27, in <module>
    execute_from_command_line(sys.argv)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/core/management/commands/test.py", line 29, in run_from_argv
    super(Command, self).run_from_argv(argv)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/core/management/commands/test.py", line 72, in handle
    failures = test_runner.run_tests(test_labels)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/test/runner.py", line 549, in run_tests
    old_config = self.setup_databases()
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/test/runner.py", line 499, in setup_databases
    self.parallel, **kwargs
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/test/runner.py", line 743, in setup_databases
    serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/db/backends/base/creation.py", line 70, in create_test_db
    run_syncdb=True,
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/core/management/__init__.py", line 130, in call_command
    return command.execute(*args, **defaults)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/db/migrations/executor.py", line 115, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/db/migrations/migration.py", line 126, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/db/migrations/operations/special.py", line 189, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/registration/migrations/0003_migrate_activatedstatus.py", line 14, in migrate_activated_status
    for rp in RegistrationProfile.objects.filter(activation_key='ALREADY_ACTIVATED').iterator():
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/db/models/query.py", line 54, in __iter__
    results = compiler.execute_sql()
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/cachalot/monkey_patch.py", line 32, in inner
    out = original(compiler, *args, **kwargs)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/cachalot/monkey_patch.py", line 82, in inner
    cache_key, table_cache_keys)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/cachalot/monkey_patch.py", line 55, in _get_result_or_execute_query
    result = execute_query_func()
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/cachalot/monkey_patch.py", line 68, in <lambda>
    execute_query_func = lambda: original(compiler, *args, **kwargs)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 835, in execute_sql
    cursor.execute(sql, params)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/raven/contrib/django/client.py", line 114, in execute
    return real_execute(self, sql, params)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/cachalot/monkey_patch.py", line 111, in inner
    out = original(cursor, sql, *args, **kwargs)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 110, in execute
    return self.cursor.execute(query, args)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/cursors.py", line 166, in execute
    result = self._query(query)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/connections.py", line 856, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/connections.py", line 1057, in _read_query_result
    result.read()
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/connections.py", line 1340, in read
    first_packet = self.connection._read_packet()
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/connections.py", line 1014, in _read_packet
    packet.check_error()
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/connections.py", line 393, in check_error
    err.raise_mysql_exception(self._data)
  File "/home/travis/build/test/webapp/.tox/python35-django110/lib/python3.5/site-packages/pymysql/err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
django.db.utils.ProgrammingError: (1146, "Table 'default.registration_registrationprofile' doesn't exist")