/** * Execute the console command. * * @return mixed */ public function handle() { $client = $this->option('client'); if (empty($client)) { $this->error('No client specified!'); exit(1); } $table = $this->option('table'); if (empty($table)) { $this->error('No table specified!'); exit(1); } $pk = $this->option('pk'); if (empty($pk)) { $pk = $table . '_id'; } $conn = $this->client_service->getPdoConnection($client); $desc_sth = $conn->query('DESC ' . $table); $desc = $desc_sth->fetchAll(PDO::FETCH_ASSOC); $ddl = $this->sql_service->stagingTableFromToolsTable($table, $pk, $desc); $this->info($ddl); }