Commit 64764f9c authored by ruchitVC's avatar ruchitVC

Update install app command

parent fc927c9e
...@@ -168,13 +168,15 @@ class InstallAppCommand extends Command ...@@ -168,13 +168,15 @@ class InstallAppCommand extends Command
} }
} }
$this->createDatabase($this->database); // create database if not exists. $this->createDatabase($this->database); // create database if not exists.
$this->migrateTables($this->database); // database migration
if ($this->confirm('You want to dump database sql ?')) { // if ($this->confirm('You want to dump database sql ?')) { // uncomment the code if you want to go ahead with existing database.
$this->dumpDB($this->database); // $this->dumpDB($this->database);
} else { // } else {
$this->migrateTables($this->database); // $this->migrateTables($this->database);
} // }
} }
/** /**
...@@ -261,17 +263,25 @@ class InstallAppCommand extends Command ...@@ -261,17 +263,25 @@ class InstallAppCommand extends Command
*/ */
protected function migrateTables($database) protected function migrateTables($database)
{ {
if ($this->confirm('You want to migrate tables?')) { DB::unprepared('USE `'.$database.'`');
// Switch to use {$this->database}
DB::unprepared('USE `'.$database.'`'); Artisan::call('migrate'); // Artisan migration
//DB::connection()->setDatabaseName($this->database); $this->info('Migration successfully done!');
Artisan::call('migrate');
$this->info('Migration successfully done!'); Artisan::call('db:seed'); // Artisan seed
$this->info('Seeding successfully done!');
if ($this->confirm('You want to seeding your database?')) {
Artisan::call('db:seed'); // if ($this->confirm('You want to migrate tables?')) { //uncomment the code if you want to populate mandatory question to user for migration and seed.
$this->info('Seeding successfully done!'); // // Switch to use {$this->database}
} // DB::unprepared('USE `'.$database.'`');
} // //DB::connection()->setDatabaseName($this->database);
// Artisan::call('migrate'); // Artisan migration
// $this->info('Migration successfully done!');
//
// if ($this->confirm('You want to seeding your database?')) {
// Artisan::call('db:seed'); // Artisan seed
// $this->info('Seeding successfully done!');
// }
// }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment