60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
|
<?php
|
||
|
namespace OC\Core\Migrations;
|
||
|
|
||
|
use Doctrine\DBAL\Schema\Schema;
|
||
|
use OCP\Migration\SimpleMigrationStep;
|
||
|
use OCP\Migration\IOutput;
|
||
|
|
||
|
/**
|
||
|
* Auto-generated migration step: Please modify to your needs!
|
||
|
*/
|
||
|
class Version13000Date20170814074715 extends SimpleMigrationStep {
|
||
|
|
||
|
/**
|
||
|
* @param IOutput $output
|
||
|
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||
|
* @param array $options
|
||
|
* @since 13.0.0
|
||
|
*/
|
||
|
public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param IOutput $output
|
||
|
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||
|
* @param array $options
|
||
|
* @return null|Schema
|
||
|
* @since 13.0.0
|
||
|
*/
|
||
|
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||
|
/** @var Schema $schema */
|
||
|
$schema = $schemaClosure();
|
||
|
|
||
|
|
||
|
if (!$schema->hasTable('accounts')) {
|
||
|
$table = $schema->createTable('accounts');
|
||
|
$table->addColumn('uid', 'string', [
|
||
|
'notnull' => true,
|
||
|
'length' => 64,
|
||
|
'default' => '',
|
||
|
]);
|
||
|
$table->addColumn('data', 'text', [
|
||
|
'notnull' => true,
|
||
|
'default' => '',
|
||
|
]);
|
||
|
$table->setPrimaryKey(['uid']);
|
||
|
}
|
||
|
|
||
|
return $schema;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param IOutput $output
|
||
|
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||
|
* @param array $options
|
||
|
* @since 13.0.0
|
||
|
*/
|
||
|
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
|
||
|
}
|
||
|
}
|