2021-08-21 14:17:14 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2021-08-21 14:25:23 +00:00
|
|
|
namespace OCA\UPschooling\Migration;
|
2021-08-21 14:17:14 +00:00
|
|
|
|
|
|
|
use Closure;
|
|
|
|
use OCP\DB\ISchemaWrapper;
|
|
|
|
use OCP\Migration\SimpleMigrationStep;
|
|
|
|
use OCP\Migration\IOutput;
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
2021-08-21 14:25:23 +00:00
|
|
|
if (!$schema->hasTable('upschooling')) {
|
|
|
|
$table = $schema->createTable('upschooling');
|
2021-08-21 14:17:14 +00:00
|
|
|
$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']);
|
2021-08-21 14:25:23 +00:00
|
|
|
$table->addIndex(['user_id'], 'upschooling_user_id_index');
|
2021-08-21 14:17:14 +00:00
|
|
|
}
|
|
|
|
return $schema;
|
|
|
|
}
|
|
|
|
}
|