Skip to content

Commit

Permalink
Move ruleset hashes to repositories table (#973)
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Jan 14, 2020
1 parent 746e81a commit 9b23f66
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Copyright (C) 2019 Dmitry Marakasov <[email protected]>
-- Copyright (C) 2019-2020 Dmitry Marakasov <[email protected]>
--
-- This file is part of repology
--
Expand All @@ -23,6 +23,6 @@
--------------------------------------------------------------------------------
SELECT
ruleset_hash
FROM repository_ruleset_hashes
FROM repositories
WHERE
repository = %(repository)s;
name = %(repository)s;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Copyright (C) 2019 Dmitry Marakasov <[email protected]>
-- Copyright (C) 2019-2020 Dmitry Marakasov <[email protected]>
--
-- This file is part of repology
--
Expand All @@ -21,14 +21,8 @@
-- @param ruleset_hash
--
--------------------------------------------------------------------------------
INSERT INTO repository_ruleset_hashes(
repository,
ruleset_hash
)
VALUES (
%(repository)s,
%(ruleset_hash)s
)
ON CONFLICT (repository)
DO UPDATE SET
ruleset_hash = EXCLUDED.ruleset_hash;
UPDATE repositories
SET
ruleset_hash = %(ruleset_hash)s
WHERE
name = %(repository)s;
12 changes: 2 additions & 10 deletions sql.d/update/create_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,8 @@ CREATE TABLE repositories (

used_package_fields text[],

ruleset_hash text NULL,

-- metadata from config
metadata jsonb NOT NULL,

Expand Down Expand Up @@ -865,16 +867,6 @@ CREATE TABLE url_relations (

CREATE INDEX ON url_relations(urlhash, metapackage_id);

--------------------------------------------------------------------------------
-- Updates
--------------------------------------------------------------------------------
DROP TABLE IF EXISTS repository_ruleset_hashes CASCADE;

CREATE TABLE repository_ruleset_hashes (
repository text NOT NULL PRIMARY KEY,
ruleset_hash text NULL
);

--------------------------------------------------------------------------------
-- Redirects
--------------------------------------------------------------------------------
Expand Down

0 comments on commit 9b23f66

Please sign in to comment.