2021-06-27 11:19:26 +00:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace OCA\GPodderSync\Migration;
|
|
|
|
|
|
|
|
use Closure;
|
|
|
|
use Doctrine\DBAL\Types\Types;
|
|
|
|
use OCP\DB\ISchemaWrapper;
|
|
|
|
use OCP\Migration\IOutput;
|
|
|
|
|
|
|
|
class Version0002Date20210524131313 extends \OCP\Migration\SimpleMigrationStep {
|
|
|
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
|
|
|
|
/** @var ISchemaWrapper $schema */
|
|
|
|
$schema = $schemaClosure();
|
|
|
|
|
2021-07-06 12:23:25 +00:00
|
|
|
if (!$schema->hasTable('gpodder_subscriptions')) {
|
|
|
|
$table = $schema->createTable('gpodder_subscriptions');
|
2021-06-27 11:19:26 +00:00
|
|
|
$table->addColumn('id', 'integer', [
|
|
|
|
'autoincrement' => true,
|
|
|
|
'notnull' => true,
|
|
|
|
]);
|
|
|
|
$table->addColumn('url', Types::STRING, [
|
|
|
|
'notnull' => true,
|
|
|
|
'length' => 500
|
|
|
|
]);
|
|
|
|
|
|
|
|
$table->addColumn('subscribed', Types::BOOLEAN, [
|
2021-07-08 17:29:40 +00:00
|
|
|
'notnull' => false,
|
2021-06-27 11:19:26 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$table->addColumn('updated', Types::DATETIME_MUTABLE, [
|
|
|
|
'notnull' => true,
|
|
|
|
]);
|
|
|
|
$table->addColumn('user_id', Types::STRING, [
|
|
|
|
'notnull' => true,
|
|
|
|
'length' => 200,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$table->setPrimaryKey(['id']);
|
|
|
|
$table->addUniqueIndex(['url', "user_id"], 'subscriptions_url_user');
|
|
|
|
|
|
|
|
}
|
|
|
|
return $schema;
|
|
|
|
}
|
|
|
|
}
|