2020-10-19 18:41:09 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace OCA\Radio\Migration;
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
2020-11-07 09:41:25 +00:00
|
|
|
if (!$schema->hasTable('favorites')) {
|
|
|
|
$table = $schema->createTable('favorites');
|
2020-10-19 18:41:09 +00:00
|
|
|
$table->addColumn('id', 'integer', [
|
|
|
|
'autoincrement' => true,
|
|
|
|
'notnull' => true,
|
|
|
|
]);
|
2020-11-06 08:11:30 +00:00
|
|
|
$table->addColumn('stationuuid', 'string', [
|
2020-10-19 18:41:09 +00:00
|
|
|
'notnull' => true,
|
|
|
|
]);
|
|
|
|
$table->addColumn('user_id', 'string', [
|
|
|
|
'notnull' => true,
|
|
|
|
]);
|
2020-11-06 08:11:30 +00:00
|
|
|
$table->addColumn('name', 'text', [
|
|
|
|
'notnull' => true,
|
2020-10-30 20:16:02 +00:00
|
|
|
]);
|
2020-11-07 09:26:41 +00:00
|
|
|
$table->addColumn('favicon', 'text');
|
|
|
|
$table->addColumn('urlresolved', 'text');
|
2020-10-19 18:41:09 +00:00
|
|
|
|
|
|
|
$table->setPrimaryKey(['id']);
|
2020-11-07 09:41:25 +00:00
|
|
|
$table->addIndex(['user_id'], 'favorites_user_id_index');
|
2020-10-19 18:41:09 +00:00
|
|
|
}
|
|
|
|
return $schema;
|
|
|
|
}
|
|
|
|
}
|