https://github.com/craftcms/plugin-port-helper
Plugin port helper for porting plugins from Craft 2 to Craft 3.
https://github.com/craftcms/plugin-port-helper
craft3 craftcms
Last synced: about 1 month ago
JSON representation
Plugin port helper for porting plugins from Craft 2 to Craft 3.
- Host: GitHub
- URL: https://github.com/craftcms/plugin-port-helper
- Owner: craftcms
- License: mit
- Created: 2017-05-26T13:29:14.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-07-23T18:51:33.000Z (almost 5 years ago)
- Last Synced: 2025-03-04T08:44:11.568Z (over 1 year ago)
- Topics: craft3, craftcms
- Language: PHP
- Homepage:
- Size: 8.79 KB
- Stars: 2
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
Plugin port helper
------------------
This script helps porting plugins from Craft 2 to Craft 3 by generating the [Install migration](https://github.com/craftcms/docs/blob/master/en/plugin-migrations.md#install-migrations).
The script will generate all the code needed to create the tables, indexes and foreign keys as well as the code needed to remove them.
## How to use this script
Run it from commandline via the php interpreter against a Craft 2 project, that has the database tables created that you want to generate the migrations for. For example
`php pluginPortHelper.php --tablePrefix=myplugin_ --namespace=craft\\myplugin --projectPath=/path/to/project > migrations.php`
### There are a few parameters you can set:
- `tablePrefix` – Prefix to use to filter tables by. If you leave out the table prefix used by Craft in the project, the script will add it automatically.
- `namespace` – Namespace that the plugin will use in Craft 3.
- `projectPath` – Valid path to the craft folder in a Craft installation. Optional, if it's the current working directory.
- `convertLocales` – If present, the helper will attempt to convert all of Craft 2 locale references in table schemas to Craft 3 Sites. This includes field names, indexes and foreign keys.