Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
v1.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Stark committed Jun 18, 2018
1 parent e394f4d commit 1bedc5a
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 9 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Changelog

## [1.3.6] - 2018-06-18
### Changed
- DB fallback: Schema - changed `url` field from `varchar(255) to `text` to allow longer urls
- DB fallback: Schema - Added `urlHash`


## [1.3.5] - 2018-05-26
### Changed
- DB fallback: Changed `tags` field form `varchar(255) to `text` to allow more tags
- DB fallback: Schema - changed `tags` field from `varchar(255) to `text` to allow more tags

## [1.3.4] - 2018-05-08
### Changed
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ostark/upper",
"description": "A cache plugin for Craft - supporting multiple Edge Caches",
"type": "craft-plugin",
"version": "1.3.5",
"version": "1.3.6",
"keywords": [
"craft",
"cms",
Expand Down Expand Up @@ -36,7 +36,6 @@
"extra": {
"name": "Upper",
"handle": "upper",
"schemaVersion": "0.1.0",
"hasCpSettings": false,
"hasCpSection": false,
"changelogUrl": "https://raw.githubusercontent.com/ostark/upper/master/CHANGELOG.md"
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Plugin extends BasePlugin
// Header
const INFO_HEADER_NAME = 'X-UPPER-CACHE';

public $schemaVersion = '1.0.0';
public $schemaVersion = '1.0.1';


/**
Expand Down
8 changes: 3 additions & 5 deletions src/migrations/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ public function safeUp()

$this->createTable(Plugin::CACHE_TABLE, [
'uid' => $this->string(40)->notNull()->unique(),
'urlHash' => $this->string(32)->notNull(),
'url' => $this->text()->notNull(),
'url' => $this->string(255)->notNull(),
'headers' => $this->text()->defaultValue(null),
'tags' => $this->text()->notNull(),
'siteId' => $this->integer(),
'dateCreated' => $this->dateTime()->notNull(),
'dateUpdated' => $this->dateTime()->null()
]);

$this->createIndex('url_idx', Plugin::CACHE_TABLE, 'urlHash', true);
$this->createIndex('url_idx', Plugin::CACHE_TABLE, 'url', true);
$this->execute("ALTER TABLE " . Plugin::CACHE_TABLE . " ADD FULLTEXT INDEX tags_fulltext (tags ASC)");

}
Expand All @@ -39,7 +38,6 @@ public function safeUp()

$this->createTable(Plugin::CACHE_TABLE, [
'uid' => $this->string(40)->notNull()->unique(),
'urlHash' => $this->string(32)->notNull(),
'url' => $this->string(255)->notNull(),
'headers' => $this->text()->defaultValue(null),
'tags' => 'varchar[]',
Expand All @@ -49,7 +47,7 @@ public function safeUp()
'PRIMARY KEY(uid)',
]);

$this->createIndex('url_idx', Plugin::CACHE_TABLE, 'urlHash', true);
$this->createIndex('url_idx', Plugin::CACHE_TABLE, 'url', true);
$this->execute("CREATE INDEX tags_array ON " . Plugin::CACHE_TABLE . " USING GIN(tags)");

}
Expand Down
43 changes: 43 additions & 0 deletions src/migrations/m180618_120307_url_index.php
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;
}
}

0 comments on commit 1bedc5a

Please sign in to comment.