Skip to content

Commit

Permalink
Fixed migration bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Jun 3, 2021
1 parent 671d1f6 commit e7584e8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)).
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e7584e8

Please sign in to comment.