mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-30 05:47:57 +01:00
Grab extension repo detail from repo.json and include in DB (#506)
* WIP Extension Repo DB Support * Wired in to extension screen, browse settings screen * Detekt changes * Ui tweaks and open in browser * Migrate ExtensionRepos on Update * Migration Cleanup * Slight cleanup / error handling * Update ExtensionRepo from Repo.json during extension search. Added Manual refresh in extension repos page. * Split repo fetching into separate API module, major refactor work * Removed development strings * Moved migration to #3 * Fixed rebase * Detekt changes * Added Replace Repository Dialog * Cleanup, removed platform specific code, PR comments * Removed extra function, reverted small change * Detekt cleanup * Apply suggestions from code review Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> * Fixed error introduced in cleanup * Tweak for multiline when * Moved getCount() to flow * changed getCount to non-suspend, used property delegation * Apply suggestions from code review Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> * Fixed formatting with updated comment string * Big wave of PR comments, renaming/other tweaks * onOpenWebsite changes * onOpenWebsite changes * trying to make single line * Renamed ExtensionRepoApi.kt to ExtensionRepoService.kt --------- Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
57
data/src/main/sqldelight/tachiyomi/data/extension_repos.sq
Normal file
57
data/src/main/sqldelight/tachiyomi/data/extension_repos.sq
Normal file
@@ -0,0 +1,57 @@
|
||||
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;
|
||||
8
data/src/main/sqldelight/tachiyomi/migrations/3.sqm
Normal file
8
data/src/main/sqldelight/tachiyomi/migrations/3.sqm
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Create ExtensionRepo table --
|
||||
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
|
||||
);
|
||||
Reference in New Issue
Block a user