How to remove Storage API without data loss I'm working on application based on Drupal 7.39 that use the Storage Api module version 7.x-1.8 with FTP container.

I'm trying to achieve is to remove this module and use the normal flow to save assets (I think that all assets will be saved in app/sites/default/files).

I downloaded all files from FTP container in app/sites/default/files folder.

I tried to disable the module, but I noticed that images fields served by the plugin are not available anymore. The association in content pages are still present but I only see a broken link.

How can I update all the fields served by the plugin to use files that are in app/sites/default/files? In other words I want to remove the plugin and all his associations to files. Is that possible? Can I migrate these associations?

Thank you.

UPDATE

As Jonathan Rhodes suggests me, here's the procedure to update uris.

$queryString = "SELECT * FROM db.file_managed WHERE uri REGEXP '^storage-a*'";

try {
    $db = new PDO("mysql:host=localhost;dbname=db;charset=utf8", "root", "root");
    $query = $db-&gt;prepare($queryString);
    $query-&gt;execute();

    $rows = $query-&gt;fetchAll(PDO::FETCH_ASSOC);

    $func = function ($element) use ($db) {
        $uri = $element['uri'];
        $uriReplaced = preg_replace('/^(storage-.*)(:\/\/.*)/', "public$2", $uri);
        $queryUpdate = "UPDATE db.file_managed SET uri = :uri WHERE fid = :fid";
        $query = $db-&gt;prepare($queryUpdate);
        $query-&gt;execute(['uri' =&gt; $uriReplaced, 'fid' =&gt; (int) $element['fid']]);
    };

    echo count($rows);
    array_map($func, $rows);
} catch (PDOException  $e) {
    echo "Error: " . $e;
}

echo 'ok';
You'll probably need to manually update the files_managed database table and change the uri to use the public:// schema.