nachopitt/db-commands

Installs: 120

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/nachopitt/db-commands

v0.3.1 2025-09-02 23:48 UTC

This package is auto-updated.

Last update: 2025-10-03 02:12:20 UTC


README

A set of Laravel Artisan commands for database management.

Installation

You can install the package via composer:

composer require nachopitt/db-commands

Usage

db:create

Create a new MySQL database.

php artisan db:create {name?}
Argument Description
name The name of the database to create. If not provided, the command will use the database name from your database.php config file.

db:drop

Drop an existing MySQL database.

php artisan db:drop {name?}
Argument Description
name The name of the database to drop. If not provided, the command will use the database name from your database.php config file.

db:export

Export an existing MySQL database into SQL statements.

php artisan db:export {schema?}
Argument Description
schema The name of the database to export. If not provided, the command will use the database name from your database.php config file.

db:import

Import a SQL file into an existing MySQL database.

php artisan db:import {file?} {--s|schema=} {--i|ignore-foreign-key-checks}
Argument Description
file The path to the SQL file to import. If not provided, the command will use database_model/{database}.sql.
--schema The name of the database to import into. If not provided, the command will use the database name from your database.php config file.
--ignore-foreign-key-checks Ignore foreign key checks while importing.

db:truncate

Truncate tables from database.

php artisan db:truncate {tables?} {--s|schema=} {--i|ignore-foreign-key-checks}
Argument Description
tables A comma-separated list of tables to truncate. If not provided, the command will truncate all tables in the database.
--schema The name of the database to truncate tables from. If not provided, the command will use the database name from your database.php config file.
--ignore-foreign-key-checks Ignore foreign key checks while truncating.

License

The MIT License (MIT). Please see License File for more information.