summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-10-27 13:39:10 +0200
committerMorris Jobke <hey@morrisjobke.de>2018-11-01 15:00:49 +0100
commit644686c0ec74f619a42c5274cd8422861df97127 (patch)
tree6a9f51b2305685a24ff4834b0da9acdaf731f6e0
parent9afff2fb20ec2c00cc958639342add7b19a00e78 (diff)
downloadnextcloud-server-644686c0ec74f619a42c5274cd8422861df97127.tar.gz
nextcloud-server-644686c0ec74f619a42c5274cd8422861df97127.zip
Create cards if none
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
-rw-r--r--core/Migrations/Version15000Date20180927120000.php50
1 files 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;
}