Skip to content

Commit

Permalink
Fixes issues with migrations and Project Config. Bump to 1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikkel committed Aug 21, 2020
1 parent 500d163 commit a9a0066
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Cache Flag Changelog

## 1.2.2 - 2020-08-21

### Fixed

- Fixes an issue where some of Cache Flag's database migrations would not run properly (causing an SQL error), if the plugin was upgraded in an environment where the Project Config Yaml files already had been updated with Cache Flag's latest schema version

## 1.2.1 - 2020-07-31

> {warning} Craft 3.5.0 has a new template caching system with [a tag-based cache invalidation strategy](https://github.com/craftcms/cms/issues/1507#issuecomment-633147835), which solves the performance issues related to automatic cache busting using the native `{% cache %}` tag in previous Craft versions. **If you're currently using this plugin only to circumvent said performance issues, you probably don't need Cache Flag anymore.** That said, Cache Flag is fully compatible with Craft 3.5 and is still a valid alternative to the native `{% cache %}` tag, e.g. for automatic bulk cache invalidation or completely "cold" template caches.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "mmikkel/cache-flag",
"description": "Cold template caches that can be flagged and automatically invalidated.",
"type": "craft-plugin",
"version": "1.2.1",
"version": "1.2.2",
"keywords": [
"craft",
"cms",
Expand Down
9 changes: 1 addition & 8 deletions src/migrations/m200720_194731_add_missing_audit_columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ class m200720_194731_add_missing_audit_columns extends Migration
*/
public function safeUp()
{
// Don't make the same config changes twice
$schemaVersion = Craft::$app->projectConfig
->get('plugins.cache-flag.schemaVersion', true);

if (\version_compare($schemaVersion, '1.0.1', '>=')) {
return;
}

$tableSchema = Craft::$app->db->schema->getTableSchema('{{%cacheflag_flags}}');

Expand All @@ -44,7 +37,7 @@ public function safeUp()
$this->addColumn('{{%cacheflag_flags}}', 'uid', $this->uid());
}

// Add missing UIDs to all rows in the flags table
// If any rows in the flags table are missing UIDs, add them
$rows = Flags::find()
->all();
foreach ($rows as $row) {
Expand Down
8 changes: 0 additions & 8 deletions src/migrations/m200721_201623_migrate_craft2_flags.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ class m200721_201623_migrate_craft2_flags extends Migration
public function safeUp()
{

// Don't make the same config changes twice
$schemaVersion = Craft::$app->projectConfig
->get('plugins.cache-flag.schemaVersion', true);

if (\version_compare($schemaVersion, '1.0.1', '>=')) {
return;
}

if (!!Flags::find()->count()) {
// There's already content in the Craft 3 table, so don't attempt to migrate anything
return;
Expand Down

0 comments on commit a9a0066

Please sign in to comment.