migration::has_table PHP Method

has_table() public method

public has_table ( $table )
    public function has_table($table)
    {
        $default = Config::db('default');
        $db = Config::db('connections.' . $default . '.database');
        $sql = 'SHOW TABLES FROM `' . $db . '`';
        list($result, $statement) = DB::ask($sql);
        $statement->setFetchMode(PDO::FETCH_NUM);
        $tables = array();
        foreach ($statement->fetchAll() as $row) {
            $tables[] = $row[0];
        }
        return in_array($table, $tables);
    }