nextcloud_ynh
nextcloud_ynh copied to clipboard
Migrate mysql db to utf8
Problem
- Description of why you made this PR
Solution
- Fix https://github.com/YunoHost-Apps/nextcloud_ynh/pull/384
PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
Validation
Minor decision
- Upgrade previous version :
- [ ] Code review :
- [ ] Approval (LGTM) :
- [ ] Approval (LGTM) :
Package_check results
- An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*
!testme
While you're at it, I would suggest to change charset to utf8mb4 : utf8 is an alias for utf8mb3, which is the UTF-8 subset of characters that are at most 3 bytes long. utf8mb4, on the other side, cant represent any UTF-8 value.
edit: and many thanks for all the work done here :) .
!testme
Thank you for pointing this out to me, let see if it works
Hmm it doesn't work
!testme
!testme
!testme
That will be nice when implemented. Thanks @kay0u
Passing by following this discussion : https://github.com/YunoHost/yunohost/pull/1284#issuecomment-906758754
Basically our my.cnf
is super old, modern debian conf has character-set-server = utf8mb4
but we ain't using it ... I'm quite tempted to look into implementing a DB general migration in Yunohost (for example during the buster->bullseye transition) - assuming it's "just" about running a ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
That would prevent nextcloud from having to implement super custom login about specifying the character set all over the place ... and apparently seafile needs this too.
ofc, that'd be great!
(By the way I was having a look into this for migrations in the core yesterday, turns out the ALTER DATABASE
only changes the default charset for new tables but doesn't change any existing table ... Theres also a similar ALTER TABLE
instruction which is only meaningful if the table content is already encoded with the appropriate charset and doesn't magically migrate the thing ... but afaik in the context of Nextcloud, exec_occ db:convert-mysql-charset
does precisely all the re-encoding ? ... but in the general case there's no magic solution for any DB)
I'm not sure to understand... @alexAubin Is it possible to migrate the database to utf8mb4? Will be done during migration do bullseyes?
Hello,
Any news about that ? I might be running into issues because of that non-UT8 character set for another app (FreshRSS https://github.com/FreshRSS/FreshRSS/issues/4139) and I wonder if that's a change I need to do for all databases or if they are independents in some way.
Thanks in advance :)
I think this PR will be obsolete after the Bullseye migration if I understood correctly.
Eeeeh not exactly because the new config only affects newly create tables. For old one, one still has to convert the content of the table, which is not a trivial operation and is apparently app-specific (you can't just take any random SQL DB and convert it). This is why the exec_occ db:convert-mysql-charset
exists and handles the reencoding.
But in my experience for Nextcloud, this conversion is likely to fail. IDK what to do with that.
!testme
!testme
Does that mean old yunohost nextcloud won't be able to migrate mysql to utf8?
Looks like the official procedure has slightly changed in Nextcloud 22 (notably, rather use of maintenance:repair
command instead of db:convert-mysql-charset
). Maybe that migration could be more robust/reliable...?
!testme