Marcus Hoffmann 4ac2f93238 put archive repo before main
Otherwise when both are enabled the metadata from the archive gets
priority over repo which is not really what we want.
It also breaks a lot of icons, featuregraphics and screenshots.

Fixes fdroid/fdroidclient#1771
Fixes fdroid/fdroidclient#1772
Fixes fdroid/fdroidclient#1686

We also update the default repo priorities for existing installs if we
find the default repos in the original order.

The query is pretty annoying to write in java, here is the raw sql form.

UPDATE fdroid_repo
SET priority = ( SELECT SUM(priority)
            FROM fdroid_repo
            WHERE address IN ('https://f-droid.org/repo', 'https://f-droid.org/archive')
          ) - priority
WHERE address IN ('https://f-droid.org/repo', 'https://f-droid.org/archive') AND
'TRUE' IN (
    SELECT
    CASE
        WHEN a.priority = b.priority-1 THEN 'TRUE'
        ELSE 'FALSE'
    END
    FROM fdroid_repo as a
    INNER JOIN fdroid_repo as b ON
    a.address = "https://f-droid.org/repo" and b.address = "https://f-droid.org/archive"
)
2020-06-24 16:34:43 +02:00
..
2020-06-24 16:34:43 +02:00
2020-04-22 15:01:37 +02:00