From e7584e817243b5a895fd5a97057a4e903b9f0d0f Mon Sep 17 00:00:00 2001 From: Ben Croker Date: Thu, 3 Jun 2021 19:02:17 +0100 Subject: [PATCH] Fixed migration bug --- CHANGELOG.md | 4 ++++ composer.json | 4 ++-- ..._column.php => m210603_120000_add_value_column.php} | 10 +--------- 3 files changed, 7 insertions(+), 11 deletions(-) rename src/migrations/{m210217_120000_add_value_column.php => m210603_120000_add_value_column.php} (69%) diff --git a/CHANGELOG.md b/CHANGELOG.md index d888615..6dafc20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 3.0.6 - 2021-06-03 +### Fixed +- Fixed a bug in which a migration was not run when updating from v2 to v3 ([#15](https://github.com/putyourlightson/craft-snaptcha/issues/15)). + ## 3.0.5 - 2021-05-08 ### Fixed - Fixed a bug in which config changes could be made twice if the plugin was installed via project config ([#15](https://github.com/putyourlightson/craft-snaptcha/issues/15)). diff --git a/composer.json b/composer.json index 1ede7ad..b48ad41 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "putyourlightson/craft-snaptcha", "description": "Automatically validates forms and prevents spam bots from submitting to your site.", - "version": "3.0.5", + "version": "3.0.6", "type": "craft-plugin", "homepage": "https://putyourlightson.com/plugins/snaptcha", "license": "proprietary", @@ -41,7 +41,7 @@ "developer": "PutYourLightsOn", "developerUrl": "https://putyourlightson.com/", "documentationUrl": "https://putyourlightson.com/plugins/snaptcha", - "schemaVersion": "3.0.0", + "schemaVersion": "3.0.6", "changelogUrl": "https://raw.githubusercontent.com/putyourlightson/craft-snaptcha/v3/CHANGELOG.md", "class": "putyourlightson\\snaptcha\\Snaptcha" } diff --git a/src/migrations/m210217_120000_add_value_column.php b/src/migrations/m210603_120000_add_value_column.php similarity index 69% rename from src/migrations/m210217_120000_add_value_column.php rename to src/migrations/m210603_120000_add_value_column.php index 6a256a4..fca3055 100644 --- a/src/migrations/m210217_120000_add_value_column.php +++ b/src/migrations/m210603_120000_add_value_column.php @@ -5,25 +5,17 @@ namespace putyourlightson\snaptcha\migrations; -use Craft; use craft\db\Migration; use craft\helpers\MigrationHelper; use putyourlightson\snaptcha\records\SnaptchaRecord; -class m210217_120000_add_value_column extends Migration +class m210603_120000_add_value_column extends Migration { /** * @inheritdoc */ public function safeUp(): bool { - $schemaVersion = Craft::$app->projectConfig->get('plugins.snaptcha.schemaVersion', true); - - // Ensure schema version exists to help prevent https://github.com/putyourlightson/craft-snaptcha/issues/15 - if ($schemaVersion && !version_compare($schemaVersion, '3.0.0', '<')) { - return true; - } - $table = SnaptchaRecord::tableName(); // Delete all rows to avoid having stale values in the DB