Skip to content
Advertisement

Laravel 5 php artisan migrate –database parameter not working

i want to migrate database using console command

when i try php artisan migrate is working, but when i try php artisan migrate --database="test" is not working it said

 [InvalidArgumentException]       
 Database [test] not configured.  

what’s wrong ? this is php artisan migrate --help

 Usage:
 migrate [options]

Options:
--database[=DATABASE]  The database connection to use.
--force                Force the operation to run when in production.
--path[=PATH]          The path of migrations files to be executed.
--pretend              Dump the SQL queries that would be run.
--seed                 Indicates if the seed task should be re-run.
-h, --help                 Display this help message
-q, --quiet                Do not output any message
-V, --version              Display this application version
--ansi                 Force ANSI output
--no-ansi              Disable ANSI output
-n, --no-interaction       Do not ask any interactive question
--env[=ENV]            The environment the command should run under.

UPDATE

after i realise it’s not database name, but database connection.. but i need to call database name, because i call this from another project to create new database and migrate it. so i need to be dynamic.. how to achieve that ?

Advertisement

Answer

I found some package that working perfectly what i need..

https://packagist.org/packages/a2way/laravel-tenant-migrate

i can run migrate:tenant (connection-name) (database-name) for create database for every tenant..

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement