cradle-sql
execute SQL queries through Cradle framework
TLDR
Execute a SQL query
SYNOPSIS
cradle sql [options] [query]
DESCRIPTION
cradle sql provides direct SQL access to databases configured in the Cradle framework. It allows executing queries, importing/exporting data, and performing database operations without needing a separate client.
The command uses the framework's database configuration, supporting multiple connections defined in the application settings. Results can be output in various formats suitable for display or processing by other tools.
This tool is useful for debugging, data inspection, and quick database operations during development. It maintains consistent authentication and connection handling with the rest of the Cradle application.
PARAMETERS
QUERY
SQL query to execute. Wrap in quotes.--file FILE
Execute SQL commands from a file.--connection NAME
Use a specific database connection.--export TABLE
Export table data as SQL statements.--import FILE
Import SQL file into the database.--database NAME
Override the default database.--format FORMAT
Output format: table, json, csv.--help
Display help information.
CAVEATS
Direct SQL access bypasses application-level validations. Destructive queries (DROP, DELETE, TRUNCATE) execute without confirmation unless the framework adds safeguards. Always backup data before running potentially destructive operations.
HISTORY
cradle sql was developed as part of the Cradle PHP framework's CLI tools to provide convenient database access. It follows the pattern of framework-integrated database commands found in other PHP frameworks like Laravel's Artisan.
