This module adds various database commands to the Ride CLI.
This command shows an overview of the database connections in the manager.
Syntax: database
Alias: db
This command converts all tables from the provided database connection to UTF-8.
Syntax: database convert utf8 <name>
<name>: Name of the connection
Alias: dbutf8
This command creates the database on the server of the connection if it does not exist.
Syntax: database create [<name> [<charset> [<collation>]]]
<name>: Name of the connection<charset>: Default charset for the database (default utf8)<collation>: Default collation for the database (default utf8_general_ci)
Alias: dbc
This command gets or sets the name of the default database connection.
Syntax: database default <name>
<name>: Name of the connection
Alias: dbdef
This command drops the database on the server of the connection if it exists.
Syntax: database drop <name>
<name>: Name of the connection
Alias: dbdr
This command registers a database connection in the manager.
Syntax: database add <name> <dsn>
<name>: Name for the connection<dsn>: DSN of the connection (protocol://username:password@host:port/database)
Alias: dba
This command gets the status of a connection.
Syntax: database status [<name>]
<name>: Name of the connection
Alias: dbs
This command unregisters a database connection from the manager.
Syntax: database delete <name>
<name>: Name for the connection
Alias: dbd
This command shows an overview of the available database drivers.
Syntax: database driver
This command executes a SQL query on the default database connection.
Syntax: database query [--connection] [<sql>]
--connection: Name of the connection to use<sql>: The SQL script to execute
Alias: dbq or query
You can use Composer to install this application.
composer require ride/cli-database