Every upgrade always attempts to CREATE TABLE oc_addressbooks

possible_bug
contacts
9.1.x
help

#1

I ran into the reasonably well-documented issues migrating contacts/calendars from 8.x to 9.0.x, but eventually resolved the issues and have been using the core contacts/calendars functionality fine since. Unfortunately, after every new point release (such as 9.1.0 to 9.1.1) when I run occ upgrade, I still see this error:

dav: An exception occurred while executing 'CREATE TABLE `oc_addressbooks` (`id` BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, `principaluri` VARCHAR(255) DEFAULT NULL, `displayname` VARCHAR(255) DEFAULT NULL, `uri` VARCHAR(255) DEFAULT NULL, `description` VARCHAR(255) DEFAULT NULL, `synctoken` INT UNSIGNED DEFAULT 1 NOT NULL, UNIQUE INDEX addressbook_index (`principaluri`, `uri`), PRIMARY KEY(`id`)) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin ENGINE = InnoDB':
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'oc_addressbooks' already exists

Despite the error, when I leave maintenance mode, everything seems to work just fine (though I do have to manually re-enable each of my plugins). Why does the upgrade script continue to attempt to re-create the addressbooks table?

Server configuration
Operating system: Ubuntu 14.04
Web server: Apache 2.4.7
Database: MySQL 5.5.52
PHP version: 5.5.9
ownCloud version (see ownCloud admin page): 9.1.1
Updated from an older ownCloud or fresh install: Updated numerous times

ownCloud log (data/owncloud.log)

{"reqId":"xJXuCNKgy8r0vy1w4l7e","remoteAddr":"","app":"dav","message":"Exception: {\"Exception\":\"Doctrine\\\\DBAL\\\\Exception\\\\TableExistsException\",\"Message\":\"An exception occu
rred while executing 'CREATE TABLE `oc_addressbooks` (`id` BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, `principaluri` VARCHAR(255) DEFAULT NULL, `displayname` VARCHAR(255) DEFAULT NULL, `ur
i`VARCHAR(255) DEFAULT NULL,`description`VARCHAR(255) DEFAULT NULL,`synctoken`INT UNSIGNED DEFAULT 1 NOT NULL, UNIQUE INDEX addressbook_index (`principaluri`,`uri`), PRIMARY KEY(`i
d`)) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin ENGINE = InnoDB':\\n\\nSQLSTATE[42S01]: Base table or view already exists: 1050 Table 'oc_addressbooks' already exists\",\"Code\":0,\"Tra
ce\":\"#0 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(116): Doctrine\\\\DBAL\\\\Driver\\\\AbstractMySQLDriver->convertExcep
tion('An exception oc...', Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException))\\n#1 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.ph
p(945): Doctrine\\\\DBAL\\\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOMySql\\\\Driver), Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException), 'CREAT
E TABLE `o...')\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/MDB2SchemaManager.php(168): Doctrine\\\\DBAL\\\\Connection->query('CREATE TABLE`o...')\\n#3 \\\/var\\\/www\\\/
owncloud\\\/lib\\\/private\\\/DB\\\/MDB2SchemaManager.php(69): OC\\\\DB\\\\MDB2SchemaManager->executeSchemaChange(Object(Doctrine\\\\DBAL\\\\Schema\\\\Schema))\\n#4 \\\/var\\\/www\\\/own
cloud\\\/lib\\\/private\\\/legacy\\\/db.php(172): OC\\\\DB\\\\MDB2SchemaManager->createDbFromStructure('\\\/var\\\/www\\\/ownclo...')\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\
/Installer.php(563): OC_DB::createDbFromStructure('\\\/var\\\/www\\\/ownclo...')\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Installer.php(533): OC\\\\Installer::installShippedA
pp('dav')\\n#7 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Updater.php(258): OC\\\\Installer::installShippedApps(true)\\n#8 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Updater.ph
p(150): OC\\\\Updater->doUpgrade('9.1.1.3', '9.1.0.15')\\n#9 \\\/var\\\/www\\\/owncloud\\\/core\\\/Command\\\/Upgrade.php(290): OC\\\\Updater->upgrade()\\n#10 \\\/var\\\/www\\\/owncloud\
\\/3rdparty\\\/symfony\\\/console\\\/Command\\\/Command.php(259): OC\\\\Core\\\\Command\\\\Upgrade->execute(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\
\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#11 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(844): Symfony\\\\Component\\\\Console\\\\Comman
d\\\\Command->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#12 \\\/var\\\/www\\\/owncloud\\\/3
rdparty\\\/symfony\\\/console\\\/Application.php(192): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand(Object(OC\\\\Core\\\\Command\\\\Upgrade), Object(Symfony\\\\Component\
\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#13 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.p
hp(123): Symfony\\\\Component\\\\Console\\\\Application->doRun(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleO
utput))\\n#14 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Console\\\/Application.php(146): Symfony\\\\Component\\\\Console\\\\Application->run(NULL, NULL)\\n#15 \\\/var\\\/www\\\/own
cloud\\\/console.php(94): OC\\\\Console\\\\Application->run()\\n#16 \\\/var\\\/www\\\/owncloud\\\/occ(11): require_once('\\\/var\\\/www\\\/ownclo...')\\n#17 {main}\",\"File\":\"\\\/var\\
\/www\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractMySQLDriver.php\",\"Line\":49}","level":3,"time":"2016-10-23T05:15:31+00:00","method":"-
-","url":"--","user":"--"}

Integrity status for oC9+

No errors have been found.

#2

Hi,

please report this directly to:

https://github.com/owncloud/core/issues