Wasn't able to activate any version of circles app after migrating to NC 18

For details have a look here: https://github.com/nextcloud/circles/issues/373

First, there was a missing column in table oc_circles_members, then inserting rows into this table during activation of the app caused duplicate key errors.

Database used is MariaDB.

There seems to be a related problem with PostgreSQL where dropping the primary index (that obviously causes the dupblicate key errors in my case) failed because it didn’t exist.

I’m not able to upgrade NC to any version beyond 17 with this error because Circles are an essential feature for lots of my users.

If there will no fix be available, could anyone send my the describe-output for all tables ‘oc_circles_%’ of a not broken circles installtion at NC 18? Perhaps I can fix it manually.

Thanks.

I’ve restored the circles app based on the mysql backup taken before migrating NC from 17 to 18. The oc_circles_% have the same structure as in our live environment now. App version in /apps folder is 0.17.10, app version in oc_appconfig is 0.17.10, “circles - enabled” is set to “no”, “circles - type” is empty.

I checked the settings on the web backend:

Back on the commandline I issued app:update circles and got the first error again:

sudo -u wwwrun php occ app:update circles
The process control (PCNTL) extensions are required in case you want to interrupt long running     commands - see http://php.net/manual/en/book.pcntl.php
[owncloud][no app in context][0] Deprecated event type for OCA\User_LDAP\User\User::postLDAPBackendAdded: null
circles new version available: 0.18.5
[owncloud][app:update][3] {"Exception":"Doctrine\\DBAL\\Schema\\SchemaException","Message":"There is no column with name 'instance' on table 'oc_circles_members'.","Code":30,"Trace":[{"file":"/srv/www/htdocs/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Schema/Table.php","line":658,"function":"columnDoesNotExist","class":"Doctrine\\DBAL\\Schema\\SchemaException","type":"::","args":["instance","oc_circles_members"]},{"file":"/srv/www/htdocs/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Schema/Table.php","line":323,"function":"getColumn","class":"Doctrine\\DBAL\\Schema\\Table","type":"->","args":["instance"]},{"file":"/srv/www/htdocs/owncloud/apps/circles/lib/Migration/Version0017Date20200202112903.php","line":80,"function":"changeColumn","class":"Doctrine\\DBAL\\Schema\\Table","type":"->","args":["instance",{"default":""}]},{"file":"/srv/www/htdocs/owncloud/lib/private/DB/MigrationService.php","line":478,"function":"changeSchema","class":"OCA\\Circles\\Migration\\Version0017Date20200202112903","type":"->","args":[{"__class__":"OC\\Migration\\SimpleOutput"},{"__class__":"Closure"},{"tablePrefix":"oc_"}]},{"file":"/srv/www/htdocs/owncloud/lib/private/DB/MigrationService.php","line":414,"function":"executeStep","class":"OC\\DB\\MigrationService","type":"->","args":["0017Date20200202112903",false]},{"file":"/srv/www/htdocs/owncloud/lib/private/legacy/app.php","line":915,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->","args":[]},{"file":"/srv/www/htdocs/owncloud/lib/private/Installer.php","line":205,"function":"updateApp","class":"OC_App","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/srv/www/htdocs/owncloud/core/Command/App/Update.php","line":109,"function":"updateAppstoreApp","class":"OC\\Installer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/srv/www/htdocs/owncloud/3rdparty/symfony/console/Command/Command.php","line":255,"function":"execute","class":"OC\\Core\\Command\\App\\Update","type":"->","args":[{"__class__":"Symfony\\Component\\Console\\Input\\ArgvInput"},{"__class__":"Symfony\\Component\\Console\\Output\\ConsoleOutput"}]},{"file":"/srv/www/htdocs/owncloud/3rdparty/symfony/console/Application.php","line":915,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[{"__class__":"Symfony\\Component\\Console\\Input\\ArgvInput"},{"__class__":"Symfony\\Component\\Console\\Output\\ConsoleOutput"}]},{"file":"/srv/www/htdocs/owncloud/3rdparty/symfony/console/Application.php","line":272,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[{"__class__":"OC\\Core\\Command\\App\\Update"},{"__class__":"Symfony\\Component\\Console\\Input\\ArgvInput"},{"__class__":"Symfony\\Component\\Console\\Output\\ConsoleOutput"}]},{"file":"/srv/www/htdocs/owncloud/3rdparty/symfony/console/Application.php","line":148,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[{"__class__":"Symfony\\Component\\Console\\Input\\ArgvInput"},{"__class__":"Symfony\\Component\\Console\\Output\\ConsoleOutput"}]},{"file":"/srv/www/htdocs/owncloud/lib/private/Console/Application.php","line":214,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[{"__class__":"Symfony\\Component\\Console\\Input\\ArgvInput"},{"__class__":"Symfony\\Component\\Console\\Output\\ConsoleOutput"}]},{"file":"/srv/www/htdocs/owncloud/console.php","line":99,"function":"run","class":"OC\\Console\\Application","type":"->","args":[]},{"file":"/srv/www/htdocs/owncloud/occ","line":11,"args":["/srv/www/htdocs/owncloud/console.php"],"function":"require_once"}],"File":"/srv/www/htdocs/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaException.php","Line":82,"CustomMessage":"Failure during update of app \"circles\""}
Error: There is no column with name 'instance' on table 'oc_circles_members'.
[owncloud][PHP][3] Undefined variable: result at /srv/www/htdocs/owncloud/core/Command/App/Update.php#116
[owncloud][PHP][3] Undefined variable: result at /srv/www/htdocs/owncloud/core/Command/App/Update.php#119

I tried this to find out wether or not I could fix the database problems and realized that a new ID-column in oc_circles_members has been created for which I would have to generate IDs. Seemed not to be my favourite solution.

I’ve added a column

instance VARCHAR(255) BINARY NOT NULL DEFAULT '''''',

and retried the update:

sudo -u wwwrun php occ app:update circles
The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php
[owncloud][no app in context][0] Deprecated event type for OCA\User_LDAP\User\User::postLDAPBackendAdded: null
[owncloud][no app in context][0] Deprecated event type for \OCP\Files::preWrite: Symfony\Component\EventDispatcher\GenericEvent
[owncloud][no app in context][0] Deprecated event type for \OCP\Files::postWrite: Symfony\Component\EventDispatcher\GenericEvent

Then I enabled it:

sudo -u wwwrun php occ app:enable circles
The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php
[owncloud][no app in context][0] Deprecated event type for OCA\User_LDAP\User\User::postLDAPBackendAdded: null
An exception occurred while executing 'SELECT * FROM `oc_circles_mb_tmp`':

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'itkcloud.oc_circles_mb_tmp' doesn't exist

As i’ve already noticed, this table is used to migrate data from old to new oc_circles_members and should have been created by the app during update oder enable command. It was before when I tried updateing from 0.17.10 to 0.18.1 in the first place (the column missing error occurred), later updates seemed to have fixed this and caused the key violation errors.

I simply renamed oc_circles_members to oc_circles_mb_tmp and created the new oc_circles_members from a mysql backup.

sudo -u wwwrun php occ app:enable circles
The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php
[owncloud][no app in context][0] Deprecated event type for OCA\User_LDAP\User\User::postLDAPBackendAdded: null
An exception occurred while executing 'INSERT INTO `oc_circles_members` (`circle_id`, `user_id`, `instance`, `user_type`, `level`, `status`, `joined`, `contact_id`) VALUES(?, ?, ?, ?, ?, ?, ?, ?)' with params ["266877b9d4f985", "volker.koenig@xxx.com", "", "3", "1", "Member", "2019-11-22 09:42:57", ""]:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '266877b9d4f985-volker.koenig@xxx.com-3--' for key 'PRIMARY'

Same error as described above.

Assuming that the new members-table should have been empty I truncated it.

Result: Next missing column.

sudo -u wwwrun php occ app:enable circles
The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php
[owncloud][no app in context][0] Deprecated event type for OCA\User_LDAP\User\User::postLDAPBackendAdded: null
An exception occurred while executing 'SELECT `user_id`, `circle_id` FROM `oc_circles_tokens` WHERE (`member_id` = ?) OR (`member_id` IS NULL)' with params [""]:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'member_id' in 'where clause'

Right now this error that was reported on Github on Feb, 13, stops me from migrating Nextcloud to any version beyond 17. Guys, I love this app, but it seems that migration from NC17 to NC18 will only be able when I completely delete Circles including the user generated content and install it on a blank system.

I would call this a critical bug.