1. Home
  2. Docs
  3. Application Framework
  4. CLI Reference
  5. deploy-table

deploy-table

$ wp mwp deploy-table <slug> <class>

This command allows you to automatically create or update the database table based on the columns definition of one or more of your active records. If you provide the special keyword all for the class name, then all active records that your plugin contains will be searched and have their database tables deployed all at once.

This command also updates your plugin meta data so that the deployed database tables are automatically tracked when you build your plugin for distribution.

@Params

<slug> (required) The slug (directory) of the plugin to update the database for
<class> (required) The relative class name of the active record you want to deploy the database table for. Do not include your base namespace.

@Example

$ wp mwp deploy-table acmecompany-gizmo Models\Gizmo
Created table wp_acme_gizmos
Success: Database schema updated.

$ wp mwp deploy-table acmecompany-gizmo all
Created table wp_acme_gizmos
Created table wp_acme_gizmo_categories
Success: Database schema updated.

Was this article helpful to you? Yes No

How can we help?