summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-10-27 13:39:10 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-10-30 13:05:10 +0100
commiteb5a20bc801e7ea2a6a50dfe33f319a71706d6dd (patch)
treedaa869cee30e4d3c0b0c69b5623597650f6bc3bf
parent72cbc0c86bf11b1e9dc404c0357c58270717ec95 (diff)
downloadnextcloud-server-eb5a20bc801e7ea2a6a50dfe33f319a71706d6dd.tar.gz
nextcloud-server-eb5a20bc801e7ea2a6a50dfe33f319a71706d6dd.zip
Create cards if none
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
-rw-r--r--core/Migrations/Version15000Date20180927120000.php51
1 files changed, 46 insertions, 5 deletions
diff --git a/core/Migrations/Version15000Date20180927120000.php b/core/Migrations/Version15000Date20180927120000.php
index 5636811baa6..7d58327475c 100644
--- a/core/Migrations/Version15000Date20180927120000.php
+++ b/core/Migrations/Version15000Date20180927120000.php
@@ -36,11 +36,52 @@ 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']);
+ $table->addIndex(['addressbookid']);
+ }
return $schema;
}