nextcloud-app-radio/lib/Migration/Version000000Date20181013124731.php

101 lines
2.9 KiB
PHP
Raw Normal View History

2020-10-19 18:41:09 +00:00
<?php
2020-11-24 14:16:53 +00:00
/**
* Radio App.
2020-11-24 14:16:53 +00:00
*
* @author Jonas Heinrich
2021-01-15 10:21:53 +00:00
* @copyright 2021 Jonas Heinrich <onny@project-insanity.org>
2020-11-24 14:16:53 +00:00
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
2020-10-19 18:41:09 +00:00
declare(strict_types=1);
namespace OCA\Radio\Migration;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
2020-10-19 18:41:09 +00:00
class Version000000Date20181013124731 extends SimpleMigrationStep
{
2020-10-19 18:41:09 +00:00
/**
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
*
2020-10-19 18:41:09 +00:00
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
2020-10-19 18:41:09 +00:00
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
if (!$schema->hasTable('favorites')) {
$table = $schema->createTable('favorites');
2020-10-19 18:41:09 +00:00
$table->addColumn('id', 'integer', [
'autoincrement' => true,
'notnull' => true,
]);
$table->addColumn('stationuuid', 'string', [
2020-10-19 18:41:09 +00:00
'notnull' => true,
]);
$table->addColumn('user_id', 'string', [
'notnull' => true,
]);
$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');
$table->addColumn('bitrate', 'text');
$table->addColumn('country', 'text');
$table->addColumn('language', 'text');
$table->addColumn('homepage', 'text');
$table->addColumn('codec', 'text');
$table->addColumn('tags', 'text');
2020-10-19 18:41:09 +00:00
$table->setPrimaryKey(['id']);
$table->addIndex(['user_id'], 'favorites_user_id_index');
2020-10-19 18:41:09 +00:00
}
2020-11-09 10:11:30 +00:00
if (!$schema->hasTable('recent')) {
$table = $schema->createTable('recent');
$table->addColumn('id', 'integer', [
'autoincrement' => true,
'notnull' => true,
]);
$table->addColumn('stationuuid', 'string', [
'notnull' => true,
]);
$table->addColumn('user_id', 'string', [
'notnull' => true,
]);
$table->addColumn('name', 'text', [
'notnull' => true,
]);
$table->addColumn('favicon', 'text');
$table->addColumn('urlresolved', 'text');
$table->addColumn('bitrate', 'text');
$table->addColumn('country', 'text');
$table->addColumn('language', 'text');
$table->addColumn('homepage', 'text');
$table->addColumn('codec', 'text');
$table->addColumn('tags', 'text');
2020-11-09 10:11:30 +00:00
$table->setPrimaryKey(['id']);
2020-11-10 13:48:04 +00:00
$table->addIndex(['user_id'], 'recent_user_id_index');
2020-11-09 10:11:30 +00:00
}
2020-10-19 18:41:09 +00:00
return $schema;
}
}