Change extension repo to extension store and add support for newer extension index format (#3349)
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
CREATE TABLE extension_repos (
|
||||
base_url TEXT NOT NULL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
short_name TEXT,
|
||||
website TEXT NOT NULL,
|
||||
signing_key_fingerprint TEXT UNIQUE NOT NULL
|
||||
);
|
||||
|
||||
findOne:
|
||||
SELECT *
|
||||
FROM extension_repos
|
||||
WHERE base_url = :base_url;
|
||||
|
||||
findOneBySigningKeyFingerprint:
|
||||
SELECT *
|
||||
FROM extension_repos
|
||||
WHERE signing_key_fingerprint = :fingerprint;
|
||||
|
||||
findAll:
|
||||
SELECT *
|
||||
FROM extension_repos;
|
||||
|
||||
count:
|
||||
SELECT COUNT(*)
|
||||
FROM extension_repos;
|
||||
|
||||
insert:
|
||||
INSERT INTO extension_repos(base_url, name, short_name, website, signing_key_fingerprint)
|
||||
VALUES (:base_url, :name, :short_name, :website, :fingerprint);
|
||||
|
||||
upsert:
|
||||
INSERT INTO extension_repos(base_url, name, short_name, website, signing_key_fingerprint)
|
||||
VALUES (:base_url, :name, :short_name, :website, :fingerprint)
|
||||
ON CONFLICT(base_url)
|
||||
DO UPDATE
|
||||
SET
|
||||
name = :name,
|
||||
short_name = :short_name,
|
||||
website =: website,
|
||||
signing_key_fingerprint = :fingerprint
|
||||
WHERE base_url = base_url;
|
||||
|
||||
replace:
|
||||
INSERT INTO extension_repos(base_url, name, short_name, website, signing_key_fingerprint)
|
||||
VALUES (:base_url, :name, :short_name, :website, :fingerprint)
|
||||
ON CONFLICT(signing_key_fingerprint)
|
||||
DO UPDATE
|
||||
SET
|
||||
base_url = :base_url,
|
||||
name = :name,
|
||||
short_name = :short_name,
|
||||
website =: website
|
||||
WHERE signing_key_fingerprint = signing_key_fingerprint;
|
||||
|
||||
delete:
|
||||
DELETE FROM extension_repos
|
||||
WHERE base_url = :base_url;
|
||||
@@ -0,0 +1,42 @@
|
||||
import kotlin.Boolean;
|
||||
|
||||
CREATE TABLE extension_store(
|
||||
index_url TEXT NOT NULL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
badge_label TEXT NOT NULL,
|
||||
signing_key TEXT NOT NULL,
|
||||
contact_website TEXT NOT NULL,
|
||||
contact_discord TEXT,
|
||||
is_legacy INTEGER AS Boolean NOT NULL
|
||||
);
|
||||
|
||||
get:
|
||||
SELECT *
|
||||
FROM extension_store
|
||||
WHERE index_url = :indexUrl;
|
||||
|
||||
getAll:
|
||||
SELECT *
|
||||
FROM extension_store;
|
||||
|
||||
getCount:
|
||||
SELECT COUNT(*)
|
||||
FROM extension_store;
|
||||
|
||||
upsert:
|
||||
INSERT INTO extension_store(index_url, name, badge_label, signing_key, contact_website, contact_discord, is_legacy)
|
||||
VALUES (:indexUrl, :name, :badgeLabel, :signingKey, :contactWebsite, :contactDiscord, :isLegacy)
|
||||
ON CONFLICT(index_url)
|
||||
DO UPDATE
|
||||
SET
|
||||
name = :name,
|
||||
badge_label = :badgeLabel,
|
||||
signing_key =: signingKey,
|
||||
contact_website = :contactWebsite,
|
||||
contact_discord = :contactDiscord,
|
||||
is_legacy = :isLegacy
|
||||
WHERE index_url = :indexUrl;
|
||||
|
||||
delete:
|
||||
DELETE FROM extension_store
|
||||
WHERE index_url = :indexUrl;
|
||||
@@ -0,0 +1,16 @@
|
||||
import kotlin.Boolean;
|
||||
|
||||
CREATE TABLE extension_store(
|
||||
index_url TEXT NOT NULL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
badge_label TEXT NOT NULL,
|
||||
signing_key TEXT NOT NULL,
|
||||
contact_website TEXT NOT NULL,
|
||||
contact_discord TEXT,
|
||||
is_legacy INTEGER AS Boolean NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO extension_store(index_url, name, badge_label, signing_key, contact_website, contact_discord, is_legacy)
|
||||
SELECT base_url || '/repo.json', name, coalesce(short_name, name), signing_key_fingerprint, website, NULL, 1 FROM extension_repos;
|
||||
|
||||
DROP TABLE extension_repos;
|
||||
Reference in New Issue
Block a user