Open ddnetters opened 9 months ago
@ddnetters Thanks for calling this out. Craft's way of handling install migrations is basically made to not make sense. I've reverted this change and made the assumption that the only reason the table wasn't installing before is that the migrations
directory was capitalized and Pixel & Tonic apparently hate PSR-4 standards. ¯_(ツ)_/¯
Let me know if you have any issue with the most recent update. This did install as expected for me on a completely fresh install so I have to believe it's fixed now, ha.
The latest commit aimed at fixing migrations breaks the installer: https://github.com/mostlyserious/craft-promptly/commit/3e8b370feb29be5a365a6272ce8ff428cfd3224c. When installing the plugin, the following exception gets thrown:
This happens because CraftCMS calls
requires_once
on the defaultInstall
migration of a plugin (https://github.com/craftcms/cms/blob/develop/src/base/Plugin.php#L317). But because thePlugin
class of promptly already declares the class by requiring it, the exception gets thrown. It goes through the following flow:php craft plugin/install promptly
Plugin
class of promptlyMostlySerious\Promptly\Migrations\Install
Plugin::install()
require_once "/var/www/html/vendor/mostlyserious/craft-promptly/src/migrations/Install.php";
(https://github.com/craftcms/cms/blob/develop/src/base/Plugin.php#L317)That's also why the exception only happens on a fresh install.
A quick solution would be to just extract all code in
MostlySerious\Promptly\Migrations\Install::safeUp();
to some static helper class so you can call that in yourPlugin.php
andInstall doesn't get declared again
.