2017-07-05 14:44:24 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2024-05-24 19:43:47 +02:00
|
|
|
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2017-07-05 14:44:24 +02:00
|
|
|
*/
|
|
|
|
namespace OC\Core\Migrations;
|
|
|
|
|
2018-01-17 11:35:20 +01:00
|
|
|
use OCP\DB\ISchemaWrapper;
|
2023-11-23 10:22:34 +01:00
|
|
|
use OCP\DB\Types;
|
2017-07-05 14:44:24 +02:00
|
|
|
use OCP\Migration\IOutput;
|
2019-11-22 20:52:10 +01:00
|
|
|
use OCP\Migration\SimpleMigrationStep;
|
2017-07-05 14:44:24 +02:00
|
|
|
|
|
|
|
class Version13000Date20170705121758 extends SimpleMigrationStep {
|
|
|
|
/**
|
|
|
|
* @param IOutput $output
|
2018-01-17 11:35:20 +01:00
|
|
|
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
2017-07-05 14:44:24 +02:00
|
|
|
* @param array $options
|
2018-01-17 11:35:20 +01:00
|
|
|
* @return null|ISchemaWrapper
|
2017-07-05 14:44:24 +02:00
|
|
|
* @since 13.0.0
|
|
|
|
*/
|
|
|
|
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
2018-01-17 11:35:20 +01:00
|
|
|
/** @var ISchemaWrapper $schema */
|
2017-07-05 14:44:24 +02:00
|
|
|
$schema = $schemaClosure();
|
|
|
|
|
|
|
|
if (!$schema->hasTable('personal_sections')) {
|
|
|
|
$table = $schema->createTable('personal_sections');
|
|
|
|
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('id', Types::STRING, [
|
2017-07-05 14:44:24 +02:00
|
|
|
'notnull' => false,
|
|
|
|
'length' => 64,
|
|
|
|
]);
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('class', Types::STRING, [
|
2017-07-05 14:44:24 +02:00
|
|
|
'notnull' => true,
|
|
|
|
'length' => 255,
|
|
|
|
]);
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('priority', Types::INTEGER, [
|
2017-07-05 14:44:24 +02:00
|
|
|
'notnull' => true,
|
|
|
|
'length' => 6,
|
|
|
|
'default' => 0,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$table->setPrimaryKey(['id'], 'personal_sections_id_index');
|
|
|
|
$table->addUniqueIndex(['class'], 'personal_sections_class');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$schema->hasTable('personal_settings')) {
|
|
|
|
$table = $schema->createTable('personal_settings');
|
|
|
|
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('id', Types::INTEGER, [
|
2017-07-05 14:44:24 +02:00
|
|
|
'autoincrement' => true,
|
|
|
|
'notnull' => true,
|
|
|
|
'length' => 20,
|
|
|
|
]);
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('class', Types::STRING, [
|
2017-07-05 14:44:24 +02:00
|
|
|
'notnull' => true,
|
|
|
|
'length' => 255,
|
|
|
|
]);
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('section', Types::STRING, [
|
2017-07-05 14:44:24 +02:00
|
|
|
'notnull' => false,
|
|
|
|
'length' => 64,
|
|
|
|
]);
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('priority', Types::INTEGER, [
|
2017-07-05 14:44:24 +02:00
|
|
|
'notnull' => true,
|
|
|
|
'length' => 6,
|
|
|
|
'default' => 0,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$table->setPrimaryKey(['id'], 'personal_settings_id_index');
|
|
|
|
$table->addUniqueIndex(['class'], 'personal_settings_class');
|
|
|
|
$table->addIndex(['section'], 'personal_settings_section');
|
|
|
|
}
|
|
|
|
|
|
|
|
return $schema;
|
|
|
|
}
|
|
|
|
}
|