walkasjesus / walkasjesus_framework

This is the Jesus Commandments Application which is build in a Python Framework
GNU General Public License v3.0
1 stars 0 forks source link

in unique_together breaks with MySQL BLOB index without index key length #51

Closed walkasjesus closed 5 years ago

walkasjesus commented 5 years ago

some Googling learns there is a bug i.c.w. mysql: https://code.djangoproject.com/ticket/2495

root@jc-acc-new:/var/www/jesuscommandments/current/jesus_commandments_website/jesus_commandments_website# bash update_database.sh Could not find cache at bible_api_cache.json Operations to perform: Apply all migrations: admin, auth, commandments_app, contenttypes, sessions, thumbnail, watermarker Running migrations: Applying contenttypes.0001_initial... OK Applying auth.0001_initial... OK Applying admin.0001_initial... OK Applying admin.0002_logentry_remove_auto_add... OK Applying admin.0003_logentry_add_action_flag_choices... 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 auth.0009_alter_user_last_name_max_length... OK Applying auth.0010_alter_group_name_max_length... OK Applying auth.0011_update_proxy_permissions... OK Applying commandments_app.0001_initial... OK Applying commandments_app.0002_blog_book_commandment_drawing_file_movie_picture_primarybiblereference_question_redirect_secondarybi... OK Applying commandments_app.0003_auto_20190924_2046...Traceback (most recent call last): File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 71, in execute return self.cursor.execute(query, args) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/MySQLdb/cursors.py", line 209, in execute res = self._query(query) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/MySQLdb/cursors.py", line 315, in _query db.query(q) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/MySQLdb/connections.py", line 226, in query _mysql.connection.query(self, query) MySQLdb._exceptions.OperationalError: (1170, "BLOB/TEXT column 'text' used in key specification without a key length")

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "manage.py", line 21, in main() File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/core/management/init.py", line 381, in execute_from_command_line utility.execute() File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/core/management/init.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, cmd_options) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, *options) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wrapped res = handle_func(args, kwargs) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 234, in handle fake_initial=fake_initial, File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/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 "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/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 "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/db/migrations/executor.py", line 245, in apply_migration state = migration.apply(state, schema_editor) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/db/migrations/migration.py", line 124, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/db/migrations/operations/models.py", line 530, in database_forwards getattr(new_model._meta, self.option_name, set()), File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 367, in alter_unique_together self.execute(self._create_unique_sql(model, columns)) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 137, in execute cursor.execute(sql, params) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 99, in execute return super().execute(sql, params) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers return executor(sql, params, many, context) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/db/utils.py", line 89, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 71, in execute return self.cursor.execute(query, args) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/MySQLdb/cursors.py", line 209, in execute res = self._query(query) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/MySQLdb/cursors.py", line 315, in _query db.query(q) File "/var/www/jesuscommandments/version_1.0/jesus_commandments_website/jesus_commandments_website/venv/lib/python3.7/site-packages/MySQLdb/connections.py", line 226, in query _mysql.connection.query(self, query) django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'text' used in key specification without a key length")

Ikbengeenrobot commented 5 years ago

Do you have a solution, maybe just switching to charfield instead of textfield?

walkasjesus commented 5 years ago

No not yet.... I do not yet understand where the problem occurs... when I restore the old model.py (from production), run the migration and update the database, it is still giving the error...

walkasjesus commented 5 years ago

Using charfield indeed does help now, Thanx!

walkasjesus commented 5 years ago

Fixed