Strata\Shell\Command\DBCommand

Automates Strata's database manipulation operations.

Intended use include:
<code>bin/strata db migrate</code>
<code>bin/strata db import</code>
<code>bin/strata db dump</code>

    Synopsis

    class DBCommand extends StrataCommandBase {
    • // Inherited members from StrataCommandBase
    • protected string $tree_line;
    • protected string $tree_end;
    • public InputInterface $input;
    • public OutputInterface $output;
    }

    Hierarchy

    Tasks

    Line Task
    119+ Ensure this works in and outside of Vagrant.
    132+ Ensure this works in an outside of Vagrant.

    Members

    protected

    • $tree_end — string
      The bottom part of a tree representation prefix.
    • $tree_line — string
      A tree representation prefix.

    public

    Methods

    protected

    • configure() — {@inheritdoc}
    • createDB() — Creates the project's database.
    • dumpCurrentDB() — Dumps the current environment's database to an .sql file in /db/
    • execute() — {@inheritdoc}
    • getMostRecent() — Returns the most recent file in $path.
    • getSqlFile() — Gets the working .sql file either from an option passed to the command or by returning the most recent sql file in /db/.
    • getWpCliPath() — Returns the path of wp-cli within the project.
    • importSqlFile() — Imports an .sql file to the current environment's database.

    Inherited from Strata\Shell\Command\StrataCommandBase

    protected

    public

    • factory()
    • fail() — Creates a visual representation of a failed status. This is useful when performing an action that can be skipped or succeed.
    • generateClassPath() — Generates a possible namespace and classname combination of a Strata controller. Mainly used to avoid hardcoding the '\\Shell\\Command\\' string everywhere.
    • nl() — Return a new line.
    • ok() — Creates a visual representation of an OK status. This is useful when performing an action that can fail or be skipped.
    • shutdown() — The shutdown function should be called each time a command has completed execution.
    • startup() — The startup function should be called each time a command is being executed. It saves the Input and Output interfaces to allow the command to use it further down the process.
    • tree() — Creates a visual representation of a tree branch. This is useful when generating a list of files.