Create cards if none

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2018-10-27 13:39:10 +02:00 committed by Morris Jobke
parent 9afff2fb20
commit 644686c0ec
No known key found for this signature in database
GPG Key ID: FE03C3A163FEDE68
1 changed files with 45 additions and 5 deletions

View File

@ -36,11 +36,51 @@ class Version15000Date20180927120000 extends SimpleMigrationStep {
/** @var ISchemaWrapper $schema */ /** @var ISchemaWrapper $schema */
$schema = $schemaClosure(); $schema = $schemaClosure();
if ($schema->hasTable('cards')) {
$table = $schema->getTable('cards'); $table = $schema->getTable('cards');
$table->addColumn('uid', Type::STRING, [ $table->addColumn('uid', Type::STRING, [
'notnull' => false, 'notnull' => false,
'length' => 255 '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; return $schema;
} }