Skip to content

Commit

Permalink
Merge branch '3.x' into 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ttempleton committed Sep 14, 2023
2 parents f0ead16 + b4b3643 commit 721022f
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Removed
- Removed support for Craft 3

## 3.0.3 - 2023-09-14

### Fixed
- Fixed a bug where fields from version 2.x wouldn't be migrated on projects that aren't using the project config (thanks @jamie-s-white)

## 3.0.2 - 2022-10-20

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"extra": {
"name": "Odds & Ends",
"handle": "tools",
"schemaVersion": "3.0.0",
"schemaVersion": "3.0.3",
"hasCpSettings": false,
"hasCpSection": false,
"changelogUrl": "https://raw.githubusercontent.com/spicywebau/craft-odds-and-ends/master/CHANGELOG.md",
Expand Down
5 changes: 5 additions & 0 deletions src/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class Tools extends Plugin
*/
public string $minVersionRequired = '2.2.0';

/**
* @inheritdoc
*/
public string $schemaVersion = '3.0.3';

/**
* @inheritdoc
*/
Expand Down
50 changes: 50 additions & 0 deletions src/migrations/m230911_000000_supercool_fields_migration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
namespace spicyweb\oddsandends\migrations;

use spicyweb\oddsandends\fields\Ancestors;
use spicyweb\oddsandends\fields\AuthorInstructions;
use spicyweb\oddsandends\fields\CategoriesMultipleGroups;
use spicyweb\oddsandends\fields\CategoriesSearch;
use spicyweb\oddsandends\fields\DisabledCategories;
use spicyweb\oddsandends\fields\DisabledDropdown;
use spicyweb\oddsandends\fields\DisabledEntries;
use spicyweb\oddsandends\fields\DisabledLightswitch;
use spicyweb\oddsandends\fields\DisabledNumber;
use spicyweb\oddsandends\fields\DisabledPlainText;
use spicyweb\oddsandends\fields\EntriesSearch;
use spicyweb\oddsandends\fields\Grid;
use spicyweb\oddsandends\fields\Width;

use Craft;
use craft\db\Migration;

class m230911_000000_supercool_fields_migration extends Migration
{
// Public Methods
// =========================================================================

public function safeUp(): bool
{
$this->update('{{%fields}}', ['type' => Ancestors::class], ['type' => 'supercool\tools\fields\Ancestors']);
$this->update('{{%fields}}', ['type' => AuthorInstructions::class], ['type' => 'supercool\tools\fields\AuthorInstructions']);
$this->update('{{%fields}}', ['type' => CategoriesMultipleGroups::class], ['type' => 'supercool\tools\fields\CategoriesMultipleGroups']);
$this->update('{{%fields}}', ['type' => CategoriesSearch::class], ['type' => 'supercool\tools\fields\CategoriesSearch']);
$this->update('{{%fields}}', ['type' => DisabledCategories::class], ['type' => 'supercool\tools\fields\DisabledCategories']);
$this->update('{{%fields}}', ['type' => DisabledDropdown::class], ['type' => 'supercool\tools\fields\DisabledDropdown']);
$this->update('{{%fields}}', ['type' => DisabledEntries::class], ['type' => 'supercool\tools\fields\DisabledEntries']);
$this->update('{{%fields}}', ['type' => DisabledLightswitch::class], ['type' => 'supercool\tools\fields\DisabledLightswitch']);
$this->update('{{%fields}}', ['type' => DisabledNumber::class], ['type' => 'supercool\tools\fields\DisabledNumber']);
$this->update('{{%fields}}', ['type' => DisabledPlainText::class], ['type' => 'supercool\tools\fields\DisabledPlainText']);
$this->update('{{%fields}}', ['type' => EntriesSearch::class], ['type' => 'supercool\tools\fields\EntriesSearch']);
$this->update('{{%fields}}', ['type' => Grid::class], ['type' => 'supercool\tools\fields\Grid']);
$this->update('{{%fields}}', ['type' => Width::class], ['type' => 'supercool\tools\fields\Width']);

return true;
}

public function safeDown(): bool
{
echo "m230911_000000_supercool_fields_migration cannot be reverted.\n";
return false;
}
}

0 comments on commit 721022f

Please sign in to comment.