-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
68 changed files
with
2,885 additions
and
928 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use DB; | ||
use Schema; | ||
|
||
use Aic\Hub\Foundation\AbstractCommand; | ||
|
||
class DatabaseReset extends AbstractCommand | ||
{ | ||
|
||
protected $signature = 'db:reset'; | ||
|
||
protected $description = 'Removes all tables in current database'; | ||
|
||
public function handle() | ||
{ | ||
|
||
if( $this->confirmReset() ) | ||
{ | ||
$this->dropTables(); | ||
|
||
} else { | ||
|
||
$this->info('Database reset command aborted. Whew!'); | ||
|
||
} | ||
|
||
} | ||
|
||
private function confirmReset() | ||
{ | ||
|
||
return ( | ||
$this->confirm('Are you sure you want to drop all tables in `'.env('DB_DATABASE').'`? [y|N]') | ||
) && ( | ||
env('APP_ENV') === 'local' || $this->confirm('You aren\'t running in `local` environment. Are you really sure? [y|N]') | ||
) && ( | ||
env('APP_ENV') !== 'production' || $this->confirm('You are in production! Are you really, really sure? [y|N]') | ||
); | ||
|
||
} | ||
|
||
private function dropTables() | ||
{ | ||
|
||
$tables = DB::select('SHOW TABLES'); | ||
|
||
// TODO: Return if there's no tables? | ||
foreach( $tables as $table ) | ||
{ | ||
$table_array = get_object_vars( $table ); | ||
$table_name = $table_array[ key( $table_array ) ]; | ||
Schema::drop( $table_name ); | ||
$this->info( 'Dropped table ' . $table_name ); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
|
||
class ImportAllCommand extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'import:all'; | ||
|
||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Run all import commands'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
|
||
//$this->call('db:reset'); | ||
//$this->call('migrate'); | ||
//$this->call('import:collections-full'); | ||
//$this->call('import:exhibitions-legacy'); | ||
//$this->call('import:events-full'); | ||
//$this->call('import:events-legacy'); | ||
//$this->call('import:dsc'); | ||
//$this->call('import:mobile'); | ||
//$this->call('import:library'); | ||
//$this->call('import:archive'); | ||
//$this->call('import:sites'); | ||
$this->call('import:set-ulan-uris'); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.