Closed marktopper closed 6 years ago
The assets has a key and a value inside the composer.json
file as you can see below.
"assets": {
"resources/assets": "public/vendor/migration-hook/assets"
}
The key (resources/assets
) is the current location of the assets within the hook folder while the value (public/vendor/migration-hook/assets
) is the location to place the assets inside the base application folder.
Closes #24
This adds the option to migrate, seed, publish assets, re-migrate, re-seed, re-publish assets, un-migrate, un-seed and un-publish assets on installation/updating and uninstallation of a hook.
Events
Install
The installation of a hook will run the specific migrations from the hook, along with the hooks seeders and publish-ing the assets.
The migrations can be skipped using the
--no-migrate
option command-line. The seeding can be skipped using the--no-seed
option command-line. The publishing of assets can be skipped using the--no-publish
option command-line.Update
The updating of a hook will re-run the un-migrated migrations from the specific hooks along with running all the hooks seeders and publish-ing any non-manually-updated assets.
The migrations can be skipped using the
--no-migrate
option command-line. The seeding can be skipped using the--no-seed
option command-line. The publishing of assets can be skipped using the--no-publish
option command-line.Uninstall
The uninstallation of a hook will rollback the migrated migrations from the specific hooks along with running all the hooks un-seeders and un-publishing all the hooks assets.
The migrations can be skipped using the
--no-unmigrate
option command-line. The seeding can be skipped using the--no-unseed
option command-line. The publishing of assets can be skipped using the--no-unpublish
option command-line.Changed assets
Any assets that have been changed from the original assets from the hook, will not be overwritten on updating of the hook. Not even if the hook has an update to that file itself.
However, you can tell the system to overwrite the assets anyway using the
--force
option command-line.Composer File
The composer file is the key to all this. The hook will have to specify the migrations, seeders, un-seeders and assets paths inside the
composer.json
file. You can see an example hook using the migrations, seeders, un-seeders, and assets here.