From 644686c0ec74f619a42c5274cd8422861df97127 Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Sat, 27 Oct 2018 13:39:10 +0200 Subject: Create cards if none MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- core/Migrations/Version15000Date20180927120000.php | 50 +++++++++++++++++++--- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/core/Migrations/Version15000Date20180927120000.php b/core/Migrations/Version15000Date20180927120000.php index 5636811baa6..d38914314ff 100644 --- a/core/Migrations/Version15000Date20180927120000.php +++ b/core/Migrations/Version15000Date20180927120000.php @@ -36,11 +36,51 @@ class Version15000Date20180927120000 extends SimpleMigrationStep { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); - $table = $schema->getTable('cards'); - $table->addColumn('uid', Type::STRING, [ - 'notnull' => false, - 'length' => 255 - ]); + if ($schema->hasTable('cards')) { + $table = $schema->getTable('cards'); + $table->addColumn('uid', Type::STRING, [ + 'notnull' => false, + 'length' => 255 + ]); + } else { + $table = $schema->createTable('cards'); + $table->addColumn('id', 'bigint', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 11, + 'unsigned' => true, + ]); + $table->addColumn('addressbookid', 'integer', [ + 'notnull' => true, + 'default' => 0, + ]); + $table->addColumn('carddata', 'blob', [ + 'notnull' => false, + ]); + $table->addColumn('uri', 'string', [ + 'notnull' => false, + 'length' => 255, + ]); + $table->addColumn('lastmodified', 'bigint', [ + 'notnull' => false, + 'length' => 11, + 'unsigned' => true, + ]); + $table->addColumn('etag', 'string', [ + 'notnull' => false, + 'length' => 32, + ]); + $table->addColumn('size', 'bigint', [ + 'notnull' => true, + 'length' => 11, + 'unsigned' => true, + ]); + $table->addColumn('uid', Type::STRING, [ + 'notnull' => false, + 'length' => 255 + ]); + $table->setPrimaryKey(['id']); + } return $schema; } -- cgit v1.2.3