This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oliver Stark
committed
Jun 18, 2018
1 parent
e394f4d
commit 1bedc5a
Showing
5 changed files
with
55 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace ostark\upper\migrations; | ||
|
||
use craft\db\Migration; | ||
use ostark\upper\Plugin; | ||
|
||
/** | ||
* m180618_120307_url_index migration. | ||
*/ | ||
class m180618_120307_url_index extends Migration | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function safeUp() | ||
{ | ||
echo " > Truncate table: " . Plugin::CACHE_TABLE . PHP_EOL; | ||
$this->truncateTable(Plugin::CACHE_TABLE); | ||
|
||
echo " > Drop index: url_idx" . PHP_EOL; | ||
$this->dropIndex('url_idx', Plugin::CACHE_TABLE); | ||
|
||
echo " > Alter column: 'url' - string to text " . PHP_EOL; | ||
$this->alterColumn(Plugin::CACHE_TABLE, 'url', $this->text()); | ||
|
||
echo " > Add column: 'urlHash'" . PHP_EOL; | ||
$this->addColumn(Plugin::CACHE_TABLE, 'urlHash', $this->string(32)->notNull()->after('url')); | ||
|
||
echo " > Create index: urlhash_idx" . PHP_EOL; | ||
|
||
$this->createIndex('urlhash_idx', Plugin::CACHE_TABLE, 'urlHash', true); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function safeDown() | ||
{ | ||
echo "m180618_120307_url_index cannot be reverted.\n"; | ||
return false; | ||
} | ||
} |