translate / pootle

Online translation tool
http://pootle.translatehouse.org
GNU General Public License v3.0
1.49k stars 285 forks source link

Error in first database migration on MySQL 8 #6917

Open tasso85 opened 2 years ago

tasso85 commented 2 years ago

Steps to reproduce:

Results (Expected/Actual):

The operation fails with the following output:

(env) developer@vm:~/pootle$ pootle migrate
System check identified some issues:

WARNINGS:
?: (pootle.W004) Email server is not available.
        HINT: Review your email settings and make sure your email server is working.
Operations to perform:
  Apply all migrations: account, accounts, auth, contenttypes, pootle_app, pootle_comment, pootle_config, pootle_data, pootle_format, pootle_fs, pootle_language, pootle_project, pootle_revision, pootle_score, pootle_statistics, pootle_store, pootle_translationproject, pootle_word, reports, sessions, sites, socialaccount, staticpages, virtualfolder
Running migrations:
  Applying accounts.0001_initial... OK
  Applying account.0001_initial... OK
  Applying account.0002_email_max_length... OK
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying pootle_app.0001_initial... OK
  Applying pootle_language.0001_initial... OK
  Applying accounts.0002_user_alt_src_langs... OK
  Applying accounts.0003_remove_pootleprofile_id... OK
  Applying accounts.0004_allow_null_last_login... OK
  Applying accounts.0005_user_indeces... OK
  Applying accounts.0006_unicode_usernames_are_valid... OK
  Applying accounts.0007_update_system_username... OK
  Applying accounts.0008_add_system_user... OK
  Applying accounts.0009_remove_currency_and_hourly_rate_fields... OK
  Applying accounts.0010_set_username_unique_error_message... OK
  Applying accounts.0011_remove_user_rates... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying pootle_project.0001_initial... OK
  Applying pootle_translationproject.0001_initial... OK
  Applying pootle_store.0001_initial... OK
  Applying pootle_translationproject.0002_remove_translationproject_disabled... OK
  Applying pootle_translationproject.0003_realpath_can_be_none... OK
  Applying pootle_translationproject.0004_add_reverse_tp_idx... OK
  Applying pootle_store.0002_make_suggestion_user_not_null... OK
  Applying pootle_store.0003_remove_unit_ordering... OK
  Applying pootle_store.0004_index_store_index_together... OK
  Applying pootle_store.0005_unit_priority... OK
  Applying pootle_store.0006_remove_auto_now_add... OK
  Applying pootle_store.0007_case_sensitive_schema... OK
  Applying pootle_store.0008_flush_django_cache...Flushing cache...
All default Django cache data removed.
 OK
  Applying pootle_format.0001_initial... OK
  Applying pootle_format.0002_default_formats... OK
  Applying pootle_store.0009_store_filetype... OK
  Applying pootle_project.0002_remove_dynamic_model_choices_localfiletype... OK
  Applying pootle_project.0003_case_sensitive_schema... OK
  Applying pootle_project.0004_correct_checkerstyle_options_order... OK
  Applying pootle_project.0005_add_none_treestyle... OK
  Applying pootle_project.0006_project_filetypes... OK
  Applying pootle_project.0007_migrate_localfiletype... OK
  Applying pootle_store.0010_set_store_filetypes... OK
  Applying pootle_store.0011_store_is_template... OK
  Applying pootle_store.0012_set_is_template... OK
  Applying pootle_store.0013_set_store_filetype_again... OK
  Applying pootle_store.0014_add_unit_index_togethers... OK
  Applying pootle_store.0015_add_slashes_validator_for_name... OK
  Applying pootle_store.0016_blank_last_sync_revision... OK
  Applying pootle_statistics.0001_initial... OK
  Applying pootle_statistics.0002_update_submission_ordering... OK
  Applying pootle_statistics.0003_scorelog_translated_wordcount... OK
  Applying pootle_statistics.0004_fill_translated_wordcount... OK
  Applying pootle_data.0001_initial... OK
  Applying pootle_data.0002_storechecksdata_tpchecksdata... OK
  Applying pootle_data.0003_index_unique_together... OK
  Applying pootle_data.0004_remove_last_updated... OK
  Applying pootle_data.0005_add_store_and_tp_data... OK
  Applying pootle_data.0006_add_cascade_deletes... OK
  Applying pootle_app.0002_mark_empty_dirs_as_obsolete... OK
  Applying pootle_app.0003_drop_existing_directory_default_permissions... OK
  Applying pootle_app.0004_set_directory_has_no_default_permissions... OK
  Applying pootle_app.0005_case_sensitive_schema... OK
  Applying pootle_app.0006_change_administrate_permission_name... OK
  Applying pootle_app.0007_add_directory_name_validation... OK
  Applying pootle_app.0008_allow_blank_directory_name_and_parent... OK
  Applying pootle_app.0009_set_default_directory_pootle_path... OK
  Applying pootle_app.0010_obsolete_path_idx... OK
  Applying pootle_app.0011_directory_tp... OK
  Applying pootle_app.0012_set_directory_tp... OK
  Applying pootle_app.0013_directory_tp_path... OK
  Applying pootle_app.0014_set_directory_tp_path... OK
  Applying pootle_app.0015_add_tp_path_idx... OK
  Applying pootle_translationproject.0005_remove_empty_translationprojects... OK
  Applying pootle_language.0002_case_insensitive_schema... OK
  Applying pootle_app.0016_set_directory_tp_again... OK
  Applying pootle_app.0017_drop_stray_directories... OK
  Applying pootle_app.0018_set_directory_base_manager_name... OK
  Applying pootle_app.0019_remove_extra_indeces... OK
  Applying sites.0001_initial... OK
  Applying pootle_comment.0001_initial... OK
  Applying pootle_comment.0002_use_abstract_module... OK
  Applying pootle_config.0001_initial... OK
  Applying pootle_project.0008_remove_project_localfiletype... OK
  Applying pootle_project.0009_set_code_as_fullname_when_no_fullname... OK
  Applying pootle_project.0010_add_reserved_code_validator... OK
  Applying pootle_project.0011_add_project_checker_validator... OK
  Applying pootle_project.0012_set_pootle_fs_treestyle... OK
  Applying pootle_project.0013_rename_treestyle_choice_to_pootle_fs... OK
  Applying pootle_project.0014_just_rename_label_for_choice... OK
  Applying pootle_translationproject.0006_relink_or_drop_orphan_translationprojects... OK
  Applying pootle_translationproject.0007_set_tp_base_manager_name... OK
  Applying virtualfolder.0001_initial... OK
  Applying virtualfolder.0002_set_unit_priorities... OK
  Applying virtualfolder.0003_case_sensitive_schema... OK
  Applying pootle_store.0017_store_priority... OK
  Applying pootle_store.0018_move_priority_to_store... OK
  Applying pootle_store.0019_remove_unit_priority... OK
  Applying pootle_store.0020_store_tp_path... OK
  Applying pootle_store.0021_set_tp_path... OK
  Applying pootle_store.0022_add_unique_tp_path_idx... OK
  Applying pootle_store.0023_add_unit_store_idxs... OK
  Applying pootle_store.0024_set_store_base_manager_name... OK
  Applying pootle_store.0025_unit_on_delete_user... OK
  Applying pootle_store.0026_suggestion_on_delete_user... OK
  Applying pootle_store.0027_unit_created_by_squashed_0055_fill_unit_source_data... OK
  Applying pootle_store.0028_unitsource_creation_revision... OK
  Applying pootle_store.0029_set_unit_creation_revision... OK
  Applying pootle_store.0030_remove_extra_indeces... OK
  Applying pootle_data.0007_add_store_and_tp_data_again... OK
  Applying pootle_data.0008_keep_data_on_delete... OK
  Applying pootle_data.0009_remove_extra_indeces... OK
  Applying pootle_format.0003_remove_extra_indeces... OK
  Applying pootle_fs.0001_initial... OK
  Applying pootle_language.0003_ensure_unique_special_chars... OK
  Applying pootle_project.0015_rename_fs_treestyle... OK
  Applying pootle_project.0016_change_treestyle_choices_label... OK
  Applying pootle_revision.0001_initial... OK
  Applying pootle_statistics.0005_index_ordering... OK
  Applying pootle_score.0001_initial... OK
  Applying pootle_score.0002_set_user_scores... OK
  Applying pootle_score.0003_add_pootle_user_store_score... OK
  Applying pootle_score.0004_zero_default_score... OK
  Applying pootle_score.0005_remove_extra_indeces... OK
  Applying pootle_statistics.0006_set_submission_base_manager_name... OK
  Applying pootle_statistics.0007_submission_revision... OK
  Applying pootle_statistics.0008_set_submission_revisions... OK
  Applying pootle_statistics.0009_rm_similarity... OK
  Applying pootle_statistics.0010_submission_on_delete_user... OK
  Applying pootle_statistics.0011_cleanup_submissions_squashed_0023_remove_scorelog... OK
  Applying pootle_statistics.0012_drop_stale_scorelog_ctype... OK
  Applying pootle_statistics.0013_remove_extra_indeces... OK
  Applying pootle_store.0031_remove_suggestion_translator_comment_f... OK
  Applying pootle_store.0032_fix_empty_wordcounts...Traceback (most recent call last):
  File "/home/developer/pootle/env/bin/pootle", line 8, in <module>
    sys.exit(main())
  File "/home/developer/pootle/env/lib/python2.7/site-packages/pootle/runner.py", line 357, in main
    run_app(project='pootle', django_settings_module='pootle.settings')
  File "/home/developer/pootle/env/lib/python2.7/site-packages/pootle/runner.py", line 338, in run_app
    management.execute_from_command_line(command)
  File "/home/developer/pootle/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/home/developer/pootle/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/developer/pootle/env/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/developer/pootle/env/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/home/developer/pootle/env/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File "/home/developer/pootle/env/lib/python2.7/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/developer/pootle/env/lib/python2.7/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/developer/pootle/env/lib/python2.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/home/developer/pootle/env/lib/python2.7/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/developer/pootle/env/lib/python2.7/site-packages/django/db/migrations/operations/special.py", line 189, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/home/developer/pootle/env/lib/python2.7/site-packages/pootle/apps/pootle_store/migrations/0032_fix_empty_wordcounts.py", line 21, in fix_empty_wordcounts
    stores = set(unit_sources.values_list("unit__store", flat=True).distinct())
  File "/home/developer/pootle/env/lib/python2.7/site-packages/django/db/models/query.py", line 256, in __iter__
    self._fetch_all()
  File "/home/developer/pootle/env/lib/python2.7/site-packages/django/db/models/query.py", line 1087, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/home/developer/pootle/env/lib/python2.7/site-packages/django/db/models/query.py", line 155, in __iter__
    for row in compiler.results_iter():
  File "/home/developer/pootle/env/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 789, in results_iter
    results = self.execute_sql(MULTI)
  File "/home/developer/pootle/env/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 835, in execute_sql
    cursor.execute(sql, params)
  File "/home/developer/pootle/env/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/developer/pootle/env/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/developer/pootle/env/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/developer/pootle/env/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 110, in execute
    return self.cursor.execute(query, args)
  File "/home/developer/pootle/env/lib/python2.7/site-packages/MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
  File "/home/developer/pootle/env/lib/python2.7/site-packages/MySQLdb/cursors.py", line 315, in _query
    db.query(q)
  File "/home/developer/pootle/env/lib/python2.7/site-packages/MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)
django.db.utils.OperationalError: (3995, "Character set 'utf8_general_ci' cannot be used in conjunction with 'binary' in call to regexp_like.")

Instead, I would expect that the database is properly migrated.

Environment (i.e. 'pootle --version', DB, OS, Browser):

(env) developer@vm-agews-svp:~/pootle$ pootle --version
Pootle 2.8.2 (Django 1.10.8, Translate Toolkit 2.2.5)
root@vm:~# cat /etc/debian_version
bullseye/sid
root@vm:~# mysql --version
mysql  Ver 8.0.29-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))