Download the PHP package enshtein/wp-migrations without Composer
On this page you can find all versions of the php package enshtein/wp-migrations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download enshtein/wp-migrations
More information about enshtein/wp-migrations
Files in enshtein/wp-migrations
Package wp-migrations
Short Description A WordPress library for managing database table schema upgrades and data seeding.
License MIT
Informations about the package wp-migrations
wp-migrations
A WordPress library for managing database table schema upgrades and data seeding.
Installation
composer require enshtein/wp-migrations
- bootstrap the package by adding
\Enshtein\WpMigrations\Migrate::instance();
to an mu-plugin.
Migrations
By default, the command will look for migration files in migrations directory alongside the vendor folder.
Use
Simply run wp migrate
on the command line using WP CLI and any migrations not already run will be executed.
Create a migration file
wp migrate create add_price_table
wp migrate create add_price_table --table=price
Other migration commands
-
wp migrate reset
- command will roll back all of your application's migrations -
wp migrate refresh
- command will roll back all of your migrations and then execute the migrate command -
wp migrate rollback
- command rolls back the last "batch" of migrations, which may include multiple migration files -
wp migrate rollback --step=3
- you may roll back a limited number of migrations by providing the step option to the rollback command wp mimgrate status
- if you would like to see which migrations have run thus far
Configuration
- command - database table name to store migrations
- table_name - the main command used to run through WP-CLI
- folder - folder name with migration files
- path - absolute path to the directory with migration files
- filename - migration file name template