Skip to content

nachopitt/db-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DB Commands

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages