2023-06-22 18:10:30 +00:00
|
|
|
<?php
|
2023-06-23 07:44:48 +00:00
|
|
|
|
2023-06-22 18:10:30 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace OCA\RePod\Migration;
|
|
|
|
|
|
|
|
use Closure;
|
|
|
|
use OCP\DB\ISchemaWrapper;
|
|
|
|
use OCP\Migration\IOutput;
|
2023-06-23 07:44:48 +00:00
|
|
|
use OCP\Migration\SimpleMigrationStep;
|
2023-06-22 18:10:30 +00:00
|
|
|
|
|
|
|
class Version000000Date20181013124731 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) {
|
|
|
|
/** @var ISchemaWrapper $schema */
|
|
|
|
$schema = $schemaClosure();
|
|
|
|
|
|
|
|
if (!$schema->hasTable('repod')) {
|
|
|
|
$table = $schema->createTable('repod');
|
|
|
|
$table->addColumn('id', 'integer', [
|
|
|
|
'autoincrement' => true,
|
|
|
|
'notnull' => true,
|
|
|
|
]);
|
|
|
|
$table->addColumn('title', 'string', [
|
|
|
|
'notnull' => true,
|
|
|
|
'length' => 200
|
|
|
|
]);
|
|
|
|
$table->addColumn('user_id', 'string', [
|
|
|
|
'notnull' => true,
|
|
|
|
'length' => 200,
|
|
|
|
]);
|
|
|
|
$table->addColumn('content', 'text', [
|
|
|
|
'notnull' => true,
|
|
|
|
'default' => ''
|
|
|
|
]);
|
|
|
|
|
|
|
|
$table->setPrimaryKey(['id']);
|
|
|
|
$table->addIndex(['user_id'], 'repod_user_id_index');
|
|
|
|
}
|
|
|
|
return $schema;
|
|
|
|
}
|
|
|
|
}
|