protected function getSchemaTables()
{
$filterTablesWhere = '';
if ($this->option("tables")) {
$tableNamesToFilter = explode(',', $this->option('tables'));
if (is_array($tableNamesToFilter) && count($tableNamesToFilter) > 0) {
$filterTablesWhere = ' AND table_name IN (\'' . implode('\', \'', $tableNamesToFilter) . '\')';
}
}
switch ($this->databaseEngine) {
case 'mysql':
$tables = \DB::select("SELECT table_name AS name FROM information_schema.tables WHERE table_type='BASE TABLE' AND table_schema = '" . env('DB_DATABASE') . "'" . $filterTablesWhere);
break;
case 'sqlsrv':
case 'dblib':
$tables = \DB::select("SELECT table_name AS name FROM information_schema.tables WHERE table_type='BASE TABLE' AND table_catalog = '" . env('DB_DATABASE') . "'" . $filterTablesWhere);
break;
case 'pgsql':
$tables = \DB::select("SELECT table_name AS name FROM information_schema.tables WHERE table_schema = 'public' AND table_type='BASE TABLE' AND table_catalog = '" . env('DB_DATABASE') . "'" . $filterTablesWhere);
break;
}
return $tables;
}