public function parse(Database $database, array $additionalTables = [])
    {
        $tables = [];
        $stmt = $this->dbh->query("SELECT OBJECT_NAME FROM USER_OBJECTS WHERE OBJECT_TYPE = 'TABLE'");

        $seqPattern = $this->getGeneratorConfig()->get()['database']['adapters']['oracle']['autoincrementSequencePattern'];

        // First load the tables (important that this happen before filling out details of tables)
        while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
            if (false !== strpos($row['OBJECT_NAME'], '$')) {
                // this is an Oracle internal table or materialized view - prune
                continue;
            }
            if (strtoupper($row['OBJECT_NAME']) === strtoupper($this->getMigrationTable())) {
                continue;
            }
            $table = new Table($row['OBJECT_NAME']);
            $table->setIdMethod($database->getDefaultIdMethod());
            $database->addTable($table);
            // Add columns, primary keys and indexes.
            $this->addColumns($table);
            $this->addPrimaryKey($table);
            $this->addIndexes($table);

            $pkColumns = $table->getPrimaryKey();
            if (1 === count($pkColumns) && $seqPattern) {
                $seqName = str_replace('${table}', $table->getName(), $seqPattern);
                $seqName = strtoupper($seqName);

                $stmt2 = $this->dbh->query("SELECT * FROM USER_SEQUENCES WHERE SEQUENCE_NAME = '" . $seqName . "'");
                $hasSeq = $stmt2->fetch(\PDO::FETCH_ASSOC);

                if ($hasSeq) {
                    $pkColumns[0]->setAutoIncrement(true);
                    $idMethodParameter = new IdMethodParameter();
                    $idMethodParameter->setValue($seqName);
                    $table->addIdMethodParameter($idMethodParameter);
                }
            }

            $tables[] = $table;
        }

        foreach ($tables as $table) {
            $this->addForeignKeys($table);
        }

        return count($tables);
    }