Repository navigation
Closed as not planned
Labels
Milestone
Description
Steps
- Setup ownCloud with sqlite
- Use
occ db:convert-typeto convert to MySQL - Refresh the page
Expected
All tables migrated
Actual
Some tables were omitted: oc_external_config, etc. These tables are created not with MDB2 schemas but with migrations.
Versions
master.
We need to adjust the command to also run the migrations on the new database to initially create the tables. I'm not sure if this will work correctly because a migration isn't always only creating tables...
± % occ db:convert-type --all-apps --password owncloud42 mysql owncloud localhost owncloudmb4
Creating schema in new database
The following tables will not be converted:
oc_external_applicable
oc_external_config
oc_external_mounts
oc_external_options
oc_migrations
Continue with the conversion (y/n)? [n] y
oc_activity
0 [>---------------------------]oc_activity_mq
0 [>---------------------------]oc_addressbookchanges
0 [>---------------------------]oc_addressbooks
1/1 [============================] 100%oc_appconfig
66/66 [============================] 100%oc_authtoken
1/1 [============================] 100%oc_calendarchanges
0 [>---------------------------]oc_calendarobjects
0 [>---------------------------]oc_calendars
1/1 [============================] 100%oc_calendarsubscriptions
0 [>---------------------------]oc_cards
0 [>---------------------------]oc_cards_properties
0 [>---------------------------]oc_comments
0 [>---------------------------]oc_comments_read_markers
0 [>---------------------------]oc_credentials
0 [>---------------------------]oc_dav_shares
0 [>---------------------------]oc_federated_reshares
0 [>---------------------------]oc_file_locks
3/3 [============================] 100%oc_filecache
14/14 [============================] 100%oc_files_trash
0 [>---------------------------]oc_group_admin
0 [>---------------------------]oc_group_user
1/1 [============================] 100%oc_groups
1/1 [============================] 100%oc_jobs
14/14 [============================] 100%oc_mimetypes
8/8 [============================] 100%oc_mounts
1/1 [============================] 100%oc_preferences
2/2 [============================] 100%oc_privatedata
0 [>---------------------------]oc_properties
0 [>---------------------------]oc_schedulingobjects
0 [>---------------------------]oc_share
0 [>---------------------------]oc_share_external
0 [>---------------------------]oc_storages
2/2 [============================] 100%oc_systemtag
0 [>---------------------------]oc_systemtag_group
0 [>---------------------------]oc_systemtag_object_mapping
0 [>---------------------------]oc_trusted_servers
0 [>---------------------------]oc_users
1/1 [============================] 100%oc_vcategory
0 [>---------------------------]oc_vcategory_to_object
0 [>---------------------------]
Activity
PVince81 commentedon Feb 2, 2017
I'm afraid that there will be no solution for this.
Migrations cannot provide a list of tables to migrate
Maybe convert-type needs to work differently: instead of using the schemas, just migrate whatever data is there regardless... in which case the command itself becomes generic and could be written as a completely separate tool (not part of ownCloud).
I'm already hearing @DeepDiver1975 from far away saying "kill convert-type" 😉
PVince81 commentedon Feb 2, 2017
Wait a minute... The option
--all-appsis supposed to also migrate extra tables.But the code seems to just through away the extra tables instead of doing so.
When the option is not set, a hint tells that you can set it.
But then it doesn't do anything. WTF
PVince81 commentedon Feb 2, 2017
Ok, found the code.
Actually it finds the extra tables only for the warnings.
When you specify
--all-appsit usesgetAllApps()instead ofgetEnabledApps()and readsdatabase.xmlto find out how to create the tables...So no luck there.
DeepDiver1975 commentedon Feb 3, 2017
😬
DeepDiver1975 commentedon Feb 3, 2017
We could clear the migrations table on the target schema and run all migration steps for all apps.
somthing like:
PVince81 commentedon Feb 3, 2017
You don't even need to clear the migration table, the convert script doesn't copy it over.
My worry about running the migration scripts is that some might want to operate on existing data. But the data hasn't been copied over yet. On the other hand, the data in the source tables is already converted to whatever format is required by the migrations once they all ran. So it might work.
I guess there can still be some possible migration scenarios where this wouldn't work, if for example a migration expects data to exist and fails if it doesn't (ex: some kind of orphaned share situation where the missing data wasn't copied yet to the target tables)
PVince81 commentedon Mar 24, 2017
We need to sort this out before final. So far I don't see any good solution apart from deprecating the tool... Or extracting it to be a general DB conversion tool not part of OC releases.
PVince81 commentedon Mar 27, 2017
Assigning to @DeepDiver1975 to make a decision
PVince81 commentedon Apr 3, 2017
We'll need a decision here, this feature will be completely broken in 10.0 and I don't see any possible solution because DB migrations work completely differently than what this feature here expects.
I'd suggest removing this feature. Maybe a separate generic tool could be provided to convert a SQLite DB to MySQL but nothing bundled or OC specific.
@pmaier1
felixboehm commentedon Apr 13, 2017
Let the command only say:
"This function is not working in ownCloud 10.0. Please contact your ownCloud Support for consulting."
Then exit.
We can add the functionality / extra tool later, when we have a good solution.
60 remaining items
rienex commentedon Aug 7, 2018
is there any news about the bug? Is there any workaround?
PVince81 commentedon Aug 8, 2018
you can help testing whether the PR works for you: #30643
TByte007 commentedon Feb 20, 2019
After 2 years and no fix and now market app stopped working with SQLite.
pmaier1 commentedon Aug 20, 2019
THX @VicDeo !
The above mentioned fix will be part of oC Server 10.3. Please try it and provide feedback here!
jacobklitzke commentedon Oct 6, 2019
Thanks @pmaier1 ! I have tested this on OwnCloud version 10.3.0 RC1. On migration from SQlite to MariaDB using the following syntax:
sudo -u apache php occ db:convert-type mysql owncloud 127.0.0.1 owncloudI receive the following errors:
VicDeo commentedon Oct 7, 2019
@jacobklitzke sounds similar to #29445
What is your MariaDB version?
VicDeo commentedon Oct 8, 2019
ok. got it.
Until PHP7.0 support is dropped we use a column listener workaround to fix migrations produced by doctrine/dbal 2.5 for MariaDB 10.2.7+
The workaround is activated by Platform name and version. When migrations are generated the platform is not MariaDB (source DB is checked in lines below while MariaDB is a target DB )
https://github.com/owncloud/core/blob/master/lib/private/DB/MySqlSchemaColumnDefinitionListener.php#L51
https://github.com/owncloud/core/blob/master/lib/private/DB/MySqlSchemaColumnDefinitionListener.php#L54
VicDeo commentedon Oct 8, 2019
@jacobklitzke
For MariaDB 10.2.7+ please try changing https://github.com/owncloud/core/blob/master/lib/private/DB/MySqlSchemaColumnDefinitionListener.php#L58
to
if (true) {it will activate the workaround unconditionally.
I don't think it worth fixing as 10.4 will probably unlock doctrine/dbal 2.7 by dropping PHP 7.0.
doctrine/dbal 2.7 has native MariaDB 10.2.7+ support.
jacobklitzke commentedon Oct 9, 2019
@VicDeo After making the change you recommended, the migration worked successfully. Thanks for all your help and work on this issue! BTW, I was using MariaDB 10.4.7.
Temporarily remove the database conversion command
KlausThornProgrammfabrik commentedon Aug 27, 2020
Worked for me: sqlite to mysql conversion with the official docs:
https://doc.owncloud.com/server/10.5/admin_manual/configuration/database/db_conversion.html
(but table_cache is now table_open_cache)
owncloud server 10.5.0.10
mysql-server 5.7.31-0ubuntu0.18.04.1
PHP 7.2.24-0ubuntu0.18.04.6 (but php 7.0 is also installed. No clue which one is used)