Skip to content

Commit

Permalink
Merge pull request #1055 from SamKer/master
Browse files Browse the repository at this point in the history
  • Loading branch information
juliushaertl committed Sep 3, 2020
2 parents f2f236f + 6deaab1 commit 86f1419
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 2 deletions.
97 changes: 97 additions & 0 deletions lib/Migration/Version030702Date20200626072306.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php

declare(strict_types=1);

namespace OCA\Richdocuments\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;

/**
* Auto-generated migration step: Please modify to your needs!
*/
class Version030702Date20200626072306 extends SimpleMigrationStep {

/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*/
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
}

/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();

$table = $schema->getTable('richdocuments_wopi');

if (!$table->hasColumn('template_id')) {
$table->addColumn('template_id', 'integer', [
'notnull' => false,
'length' => 4,
]);
}

if (!$table->hasColumn('hide_download')) {
$table->addColumn('hide_download', 'boolean', [
'notnull' => true,
'default' => false,
]);
}

if (!$table->hasColumn('share')) {
$table->addColumn('share', 'string', [
'notnull' => false,
'length' => 64
]);
}

if (!$table->hasColumn('direct')) {
$table->addColumn('direct', 'boolean', [
'notnull' => true,
'default' => false,
]);
}
if (!$table->hasColumn('is_remote_token')) {
$table->addColumn('is_remote_token', 'boolean', [
'notnull' => true,
'default' => false,
]);
}

if (!$table->hasColumn('remote_server')) {
$table->addColumn('remote_server', 'string', [
'notnull' => true,
'default' => '',
]);

}
if (!$table->hasColumn('remote_server_token')) {
$table->addColumn('remote_server_token', 'string', [
'notnull' => true,
'length' => 32,
'default' => '',
]);
}


return $schema;
}

/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*/
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
}
}
6 changes: 4 additions & 2 deletions lib/Migration/Version2060Date20200302132145.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

class Version2060Date20200302132145 extends SimpleMigrationStep {
class Version2060Date20200302132145 extends SimpleMigrationStep
{

/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options)
{
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();

Expand Down

0 comments on commit 86f1419

Please sign in to comment.