Skip to content
Snippets Groups Projects
Commit 92702082 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Jan-Hendrik Willms
Browse files

add migrations that fixes issues with clipboard tables, fixes #776

parent 7f1bdc86
No related branches found
No related tags found
No related merge requests found
<?php
final class AdjustClipboardTables extends Migration
{
public function description()
{
return 'Alter clipboard tables by fixing indices, column types and collations';
}
protected function up()
{
$query = "ALTER TABLE `clipboards`
CHANGE COLUMN `name` `name` VARCHAR(256) NOT NULL DEFAULT '',
ADD INDEX `user_id` (`user_id`)";
DBManager::get()->exec($query);
$query = "ALTER TABLE `clipboard_items`
CHANGE COLUMN `range_id` `range_id` CHAR(32) CHARACTER SET latin1 COLLATE `latin1_bin` NOT NULL,
ADD INDEX `clipboard_id` (`clipboard_id`),
ADD INDEX `range` (`range_id`,`range_type`)";
DBManager::get()->exec($query);
}
protected function down()
{
$query = "ALTER TABLE `clipboard_items`
CHANGE COLUMN `range_id` `range_id` VARCHAR(98) CHARACTER SET latin1 COLLATE `latin1_bin` NOT NULL,
DROP INDEX `clipboard_id`,
DROP INDEX `range`";
DBManager::get()->exec($query);
$query = "ALTER TABLE `clipboards`
CHANGE COLUMN `name` `name` VARCHAR(256) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
DROP INDEX `user_id`";
DBManager::get()->exec($query);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment