You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, as you saw, the guide is outdated. It's about EteSync 1.0 rather than 2.0. The setup process should be very similar though, just a few things are renamed (like etebase-server.ini which you already noticed).
Anyhow, it seems to be that MariaDB unlike Postgres/Sqlite requires you to set a max length to all fields used as indices.
I don't currently have time to figure this out and make the adjustments needed for MariaDB, but if you are able, you can try doing it locally. Just change the uid fields to have a max_length of let's say 50 (if they are binary fields), run ./manage.py makemigrations followed by ./manage.py migrate, and it should then work. If you get it fixed we can look into adding the fixes to upstream too.
btw.: I am a more a less silent tester of etesync. At the time, i successfully selfhosted it on a root server at hetzner, on uberspace and with the new docker file on my raspberry pi combined with portainer. It all works. I am also running the etesync-dav client on my mac and integrated etesync in my native calender, reminder and contacts app. Just one thing: I would love to have multiple Accounts in Etesync Notes on Android. Thats possible?
Sorry, same error…
On a fresh install, I got the following:
> ./manage.py migrate
[...]
Applying django_etebase.0031_auto_20201013_1336... OK
Applying django_etebase.0032_auto_20201013_1409...Traceback (most recent call last):
File "/opt/etebase/.venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
[...]
File "/opt/etebase/.venv/lib/python3.7/site-packages/MySQLdb/connections.py", line 259, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'uid' used in key specification without a key length")
To fix, I have to ALTER MySQL schema:
mysql etebase -e 'ALTER TABLE django_etebase_collectiontype MODIFY uid VARBINARY(255) NOT NULL;'
Then I can finish the migrations:
> ./manage.py migrate
System check identified some issues:
WARNINGS:
django_etebase.CollectionType.uid: (fields.W162) MySQL does not support a database index on longblob columns.
HINT: An index won't be created. Silence this warning if you don't care about it.
Operations to perform:
Apply all migrations: admin, auth, contenttypes, django_etebase, myauth, sessions, token_auth
Running migrations:
Applying django_etebase.0032_auto_20201013_1409... OK
Applying django_etebase.0033_collection_uid... OK
Applying django_etebase.0034_auto_20201214_1124... OK
Applying django_etebase.0035_auto_20201214_1126... OK
Applying django_etebase.0036_auto_20201214_1128... OK
Applying django_etebase.0037_auto_20210127_1237... OK
Applying myauth.0002_auto_20200515_0801... OK
Applying myauth.0003_auto_20201119_0810... OK
Applying sessions.0001_initial... OK
Applying token_auth.0001_initial... OK
I think patch 32 must be edited to fix the bug, newpatch 37 doesn't seem to be necessary.
Can you check the SQL? Maybe it should be maxlength and I should be setting something else.
I just noticed: MySQL does not support a database index on longblob columns. So that's a problem anyway...
Does mysql support it for varbinary?
Could you try to lookup how to get django to use varbinary? I don't have time at the moment.
Yes, MySQL supports index (unique or not) on VARBINARY. If I understood correctly MySQL can only index first bytes of a (LONG)BLOB so it cannot creates a UNIQUE index.
Grr.. I don't know what to say. We could potentially have a custom field, though it sounds like a lot of effort for a db we don't use ourselves. Anyone willing to take a jab at it?
This is not part of the migration, the migrations will still fail. We need to find a way to do it as part of the migration (I think you can run raw sql commands, so a patch shouldn't be too hard to build).
Activity
tasn commentedon Nov 17, 2020
First of all, as you saw, the guide is outdated. It's about EteSync 1.0 rather than 2.0. The setup process should be very similar though, just a few things are renamed (like
etebase-server.iniwhich you already noticed).Anyhow, it seems to be that MariaDB unlike Postgres/Sqlite requires you to set a max length to all fields used as indices.
I don't currently have time to figure this out and make the adjustments needed for MariaDB, but if you are able, you can try doing it locally. Just change the
uidfields to have a max_length of let's say 50 (if they are binary fields), run./manage.py makemigrationsfollowed by./manage.py migrate, and it should then work. If you get it fixed we can look into adding the fixes to upstream too.lucollab commentedon Nov 17, 2020
Hey there,
i am also running etesync on uberspace, but etesync 2.0.
Here are the steps i made (but without mysql, i am just running 2-3 Users):
https://sub.yourdomain.de/admin
tasn commentedon Nov 17, 2020
@lucollab: I edited your comment to have everything included as code so it renders nicely. :)
lucollab commentedon Nov 17, 2020
@tasn Ah thanks!! :-D dont know why i am always struggeling with such functions :-D
lucollab commentedon Nov 17, 2020
btw.: I am a more a less silent tester of etesync. At the time, i successfully selfhosted it on a root server at hetzner, on uberspace and with the new docker file on my raspberry pi combined with portainer. It all works. I am also running the etesync-dav client on my mac and integrated etesync in my native calender, reminder and contacts app. Just one thing: I would love to have multiple Accounts in Etesync Notes on Android. Thats possible?
tasn commentedon Nov 17, 2020
Glad to hear. :)
It's possible, though not yet implemented. Could you maybe open a ticket here: https://github.com/etesync/etesync-notes/issues ?
Let's not hijack this thread.
Altahrim commentedon Jan 27, 2021
Hello,
I got the same problem on MySQL 8.
As @tasn suspected, it can be fixed with something like this :
Then is it possible to apply patches >= 32.
tasn commentedon Jan 27, 2021
Is this the only key that's problematic? If so, I can easily fix it.
Altahrim commentedon Jan 27, 2021
Yes,I think so. I was able to launch service and create an account just after.
tasn commentedon Jan 27, 2021
Fixed. Don't forget to run
./manage.py migrateto update the db.Altahrim commentedon Jan 27, 2021
Sorry, same error…
On a fresh install, I got the following:
To fix, I have to ALTER MySQL schema:
mysql etebase -e 'ALTER TABLE django_etebase_collectiontype MODIFY uid VARBINARY(255) NOT NULL;'Then I can finish the migrations:
I think patch 32 must be edited to fix the bug, newpatch 37 doesn't seem to be necessary.
tasn commentedon Jan 27, 2021
Fixed. :)
Patch old DB migration in order to fix mysql issues.
Altahrim commentedon Jan 27, 2021
Arf, sorry, I still have the same error.
I am wondering why Django creates a
LONGBLOB, I think it should be aVARBINARY. Any idea how to do that?tasn commentedon Jan 27, 2021
Can you check the SQL? Maybe it should be maxlength and I should be setting something else.
I just noticed:
MySQL does not support a database index on longblob columns.So that's a problem anyway...Does mysql support it for varbinary?
Could you try to lookup how to get django to use varbinary? I don't have time at the moment.
Altahrim commentedon Jan 27, 2021
Yes, MySQL supports index (unique or not) on
VARBINARY. If I understood correctly MySQL can only index first bytes of a(LONG)BLOBso it cannot creates aUNIQUEindex.It seems Django always translate
BinaryFieldintoLONGBLOBfor MySQL.It may be possible to use
TextField(aka.VARCHARfor MySQL) with binary encoding (see: binary fields in MySQL) but I didn't find how to set collation for a single field…tasn commentedon Jan 27, 2021
Grr.. I don't know what to say. We could potentially have a custom field, though it sounds like a lot of effort for a db we don't use ourselves. Anyone willing to take a jab at it?
Altahrim commentedon Jan 28, 2021
For anyone hitting this bug, here is a temporary workaround:
./manage.py migrate # Fail on patch 32@tasn Thank you for your time :)
tasn commentedon Jan 28, 2021
Hm... I wonder. Maybe there's a way to modify the migration to run custom SQL for mariadb/mysql?
plsnotracking commentedon Feb 19, 2021
https://stackoverflow.com/a/49317165 - @tasn @Altahrim @victor-rds we can do this with Django?
Or would it be safer to run something one off (https://docs.djangoproject.com/en/dev/ref/migration-operations/#runsql) at the time of init and then leave it be.
tasn commentedon Feb 19, 2021
This is not part of the migration, the migrations will still fail. We need to find a way to do it as part of the migration (I think you can run raw sql commands, so a patch shouldn't be too hard to build).