initialsetup migration mysql error

When things don't work as they should.
Post Reply
Garcimore
Posts: 3
Joined: Fri Mar 27, 2020 2:04 pm

initialsetup migration mysql error

Post by Garcimore »

Hi everyone,

First thanks to the developers for this great product, i tried the docker instance and was very pleased with the results so i wanted to merge it with my current setup, which is an arch linux with mysql ( Ver 15.1 Distrib 10.4.12-MariaDB, for Linux (x86_64) using readline 5.1 ) database backend.

However when running mayan-edms initialsetup i encounter the following error :

Running migrations:
Applying contenttypes.0001_initial... OK
Applying permissions.0001_initial... OK
Applying auth.0001_initial... OK
Applying permissions.0002_auto_20150628_0533... OK
Applying acls.0001_initial... OK
Applying acls.0002_auto_20150703_0513... OK
Applying acls.0003_auto_20180402_0339... OK
Applying actstream.0001_initial... OK
Applying actstream.0002_remove_action_data... OK
Applying actstream.0003_add_follow_flag... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... 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 authtoken.0001_initial... OK
Applying authtoken.0002_auto_20160226_1747... OK
Applying autoadmin.0001_initial... OK
Applying documents.0001_initial... OK
Applying ocr.0001_initial... OK
Applying documents.0002_auto_20150608_1902... OK
Applying documents.0003_auto_20150608_1915... OK
Applying documents.0004_auto_20150616_1930... OK
Applying documents.0005_auto_20150617_0358... OK
Applying ocr.0002_documentpagecontent... OK
Applying ocr.0003_auto_20150617_0401... OK
Applying documents.0006_remove_documentpage_content_old... OK
Applying documents.0007_remove_documentpage_page_label... OK
Applying documents.0008_auto_20150624_0520... OK
Applying documents.0009_document_in_trash... OK
Applying documents.0010_auto_20150704_0054... OK
Applying documents.0011_auto_20150704_0508... OK
Applying documents.0012_auto_20150705_0347... OK
Applying documents.0013_document_is_stub... OK
Applying documents.0014_auto_20150708_0107... OK
Applying documents.0015_auto_20150708_0113... OK
Applying documents.0016_auto_20150708_0325... OK
Applying documents.0017_auto_20150714_0056... OK
Applying documents.0018_auto_20150714_2227... OK
Applying documents.0019_auto_20150714_2232... OK
Applying documents.0020_auto_20150714_2233... OK
Applying documents.0021_auto_20150714_2238... OK
Applying documents.0022_auto_20150715_0258... OK
Applying documents.0023_auto_20150715_0259... OK
Applying documents.0024_auto_20150715_0714... OK
Applying documents.0025_auto_20150718_0742... OK
Applying documents.0026_auto_20150729_2140... OK
Applying documents.0027_auto_20150824_0702... OK
Applying documents.0028_newversionblock... OK
Applying documents.0029_auto_20160122_0755... OK
Applying documents.0030_auto_20160309_1837... OK
Applying documents.0031_convert_uuid... OK
Applying documents.0032_auto_20160315_0537... OK
Applying documents.0033_auto_20160325_0052... OK
Applying documents.0034_auto_20160509_2321... OK
Applying cabinets.0001_initial... OK
Applying cabinets.0002_auto_20190729_0236... OK
Applying documents.0035_auto_20161102_0633... OK
Applying documents.0036_auto_20161222_0534... OK
Applying documents.0037_auto_20161231_0617... OK
Applying documents.0038_auto_20170705_2008... OK
Applying documents.0039_duplicateddocument... OK
Applying documents.0040_auto_20170725_1111... OK
Applying documents.0041_auto_20170823_1855... OK
Applying documents.0042_auto_20180403_0702... OK
Applying documents.0043_auto_20180429_0759... OK
Applying documents.0044_auto_20180823_0452... OK
Applying documents.0045_auto_20180917_0645... OK
Applying documents.0046_auto_20180917_0713... OK
Applying documents.0047_auto_20180917_0737... OK
Applying documents.0048_auto_20190711_0544... OK
Applying documents.0049_auto_20190715_0454... OK
Applying documents.0050_auto_20190725_0451... OK
Applying checkouts.0001_initial... OK
Applying checkouts.0002_documentcheckout_user... OK
Applying checkouts.0003_auto_20150617_0325... OK
Applying checkouts.0004_auto_20150617_0330... OK
Applying checkouts.0005_auto_20160122_0756... OK
Applying checkouts.0006_newversionblock... OK
Applying checkouts.0007_auto_20180310_1715... OK
Applying checkouts.0008_checkedoutdocument... OK
Applying common.0001_initial... OK
Applying common.0002_auto_20150608_1902... OK
Applying common.0003_auto_20150614_0723... OK
Applying common.0004_delete_anonymoususersingleton... OK
Applying common.0005_auto_20150706_1832... OK
Applying common.0006_auto_20160313_0313... OK
Applying common.0007_auto_20170118_1758... OK
Applying common.0008_errorlogentry... OK
Applying common.0009_auto_20180402_0339... OK
Applying common.0010_auto_20180403_0702... OK
Applying common.0011_auto_20180429_0758... OK
Applying common.0012_auto_20190711_0548... OK
Applying common.0013_auto_20190725_0452... OK
Applying common.0014_auto_20200210_0836... OK
Applying converter.0001_initial... OK
Applying converter.0002_auto_20150608_1943... OK
Applying converter.0003_auto_20150704_0731... OK
Applying converter.0004_auto_20150704_0753... OK
Applying converter.0005_auto_20150708_0118... OK
Applying converter.0006_auto_20150708_0120... OK
Applying converter.0007_auto_20150711_0656... OK
Applying converter.0008_auto_20150711_0723... OK
Applying converter.0009_auto_20150714_2228... OK
Applying converter.0010_auto_20150815_0351... OK
Applying converter.0011_auto_20170118_1758... OK
Applying converter.0012_auto_20170714_2133... OK
Applying converter.0013_auto_20180823_2353... OK
Applying converter.0014_auto_20190814_0013... OK
Applying converter.0015_auto_20190814_0014...Traceback (most recent call last):
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/db/models/query.py", line 480, in update_or_create
obj = self.select_for_update().get(**lookup)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/db/models/query.py", line 378, in get
raise self.model.DoesNotExist(
__fake__.DoesNotExist: StoredLayer matching query does not exist.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/db/backends/utils.py", line 62, in execute
return self.cursor.execute(sql)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 101, in execute
return self.cursor.execute(query, args)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/MySQLdb/cursors.py", line 209, in execute
res = self._query(query)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/MySQLdb/cursors.py", line 315, in _query
db.query(q)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/MySQLdb/connections.py", line 226, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1305, 'SAVEPOINT s140644614530880_x2 does not exist')

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

Traceback (most recent call last):
File "/home/mayan/mayan-edms/bin/mayan-edms.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/mayan/apps/common/management/commands/initialsetup.py", line 89, in handle
pre_initial_setup.send(sender=self)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 191, in send
return [
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 192, in <listcomp>
(receiver, receiver(signal=self, sender=sender, **named))
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/mayan/apps/common/handlers.py", line 10, in handler_pre_initial_setup
management.call_command(command_name='migrate', interactive=False)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/core/management/__init__.py", line 131, in call_command
return command.execute(*args, **defaults)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 202, in handle
post_migrate_state = executor.migrate(
File "/home/mayan/mayan-edms/lib/python3.8/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/mayan/mayan-edms/lib/python3.8/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/mayan/mayan-edms/lib/python3.8/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "/home/mayan/mayan-edms/lib/python3.8/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/mayan/mayan-edms/lib/python3.8/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards
self.code(from_state.apps, schema_editor)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/mayan/apps/converter/migrations/0015_auto_20190814_0014.py", line 19, in code_copy_transformations
stored_layer, created = StoredLayer.objects.using(schema_editor.connection.alias).update_or_create(
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/db/models/query.py", line 484, in update_or_create
obj, created = self._create_object_from_params(lookup, params, lock=True)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/db/models/query.py", line 500, in _create_object_from_params
obj = self.create(**params)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/db/transaction.py", line 207, in __exit__
connection.savepoint_commit(sid)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/db/backends/base/base.py", line 363, in savepoint_commit
self._savepoint_commit(sid)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/db/backends/base/base.py", line 312, in _savepoint_commit
cursor.execute(self.ops.savepoint_commit_sql(sid))
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/db/backends/utils.py", line 62, in execute
return self.cursor.execute(sql)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 101, in execute
return self.cursor.execute(query, args)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/MySQLdb/cursors.py", line 209, in execute
res = self._query(query)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/MySQLdb/cursors.py", line 315, in _query
db.query(q)
File "/home/mayan/mayan-edms/lib/python3.8/site-packages/MySQLdb/connections.py", line 226, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1305, 'SAVEPOINT s140644614530880_x2 does not exist')

I tried to search on the web for similar cases but unfortunately no luck,

I raised an other issue while running pip install --no-use-pep517 mayan-edms
Which raised the following error ( i don't think is any related to the issue above, fixed with adding idna==2.8 ) :

ERROR: requests 2.21.0 has requirement idna<2.9,>=2.5, but you'll have idna 2.9 which is incompatible.

If there is no official support on arch linux i was thinking of initialiazing the database with postgresql, convert it to mysql then mount the dump on my current mysql install, would it be possible ?

Thanks in advance for your help,

Dorian.
Garcimore
Posts: 3
Joined: Fri Mar 27, 2020 2:04 pm

Re: initialsetup migration mysql error

Post by Garcimore »

MYSQL Queries log ( Only the last ones ) :

200327 15:42:19 26 Query ALTER TABLE `converter_objectlayer` ADD COLUMN `stored_layer_id` integer NOT NULL
26 Query SELECT engine FROM information_schema.tables WHERE table_name = 'converter_objectlayer'
26 Query ALTER TABLE `converter_layertransformation` ADD COLUMN `object_layer_id` integer NOT NULL
26 Query SELECT engine FROM information_schema.tables WHERE table_name = 'converter_layertransformation'
26 Query ALTER TABLE `converter_objectlayer` ADD CONSTRAINT `converter_objectlayer_content_type_id_object_i_967137bc_uniq` UNIQUE (`content_type_id`, `object_id`, `stored_layer_id`)
26 Query ALTER TABLE `converter_layertransformation` ADD CONSTRAINT `converter_layertransform_object_layer_id_order_ca82a520_uniq` UNIQUE (`object_layer_id`, `order`)
26 Query CREATE INDEX `converter_layertransformation_order_84376246` ON `converter_layertransformation` (`order`)
26 Query ALTER TABLE `converter_objectlayer` ADD CONSTRAINT `converter_objectlaye_content_type_id_3f77d1c1_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`)
26 Query ALTER TABLE `converter_objectlayer` ADD CONSTRAINT `converter_objectlaye_stored_layer_id_a23e6eb0_fk_converter` FOREIGN KEY (`stored_layer_id`) REFERENCES `converter_storedlayer` (`id`)
26 Query ALTER TABLE `converter_layertransformation` ADD CONSTRAINT `converter_layertrans_object_layer_id_9ed104d0_fk_converter` FOREIGN KEY (`object_layer_id`) REFERENCES `converter_objectlayer` (`id`)
26 Query SHOW FULL TABLES
26 Query INSERT INTO `django_migrations` (`app`, `name`, `applied`) VALUES ('converter', '0014_auto_20190814_0013', '2020-03-27 14:42:19.366354')
26 Query COMMIT
26 Query SET autocommit=1
26 Query SAVEPOINT `s140644614530880_x1`
26 Query SELECT `converter_storedlayer`.`id`, `converter_storedlayer`.`name`, `converter_storedlayer`.`order` FROM `converter_storedlayer` WHERE `converter_storedlayer`.`name` = 'saved_transformations' FOR UPDATE
26 Query SAVEPOINT `s140644614530880_x2`
26 Query INSERT INTO `converter_storedlayer` (`name`, `order`) VALUES ('saved_transformations', 100)
26 Query RELEASE SAVEPOINT `s140644614530880_x2`
26 Query ROLLBACK TO SAVEPOINT `s140644614530880_x2`
26 Query ROLLBACK TO SAVEPOINT `s140644614530880_x1`
26 Query ROLLBACK
26 Query SET autocommit=1
User avatar
rosarior
Developer
Developer
Posts: 546
Joined: Tue Aug 21, 2018 3:28 am
Location: Puerto Rico
Contact:

Re: initialsetup migration mysql error

Post by rosarior »

Try with MySQL 5.7.x or MariaDB 5.5.x. Version 10 and up of both products introduced changes that seems to be breaking compatibility.
Garcimore
Posts: 3
Joined: Fri Mar 27, 2020 2:04 pm

Re: initialsetup migration mysql error

Post by Garcimore »

Ok will try it out, thank you for your answer !
Post Reply