1{
2 fetchFromGitHub,
3 lib,
4 postgresql,
5 postgresqlBuildExtension,
6}:
7
8let
9 sources = {
10 "13" = {
11 version = "1.4";
12 hash = "sha256-1cyvVEC9MQGMr7Tg6EUbsVBrMc8ahdFS3+CmDkmAq4Y=";
13 };
14 "14" = {
15 version = "1.5";
16 hash = "sha256-RRSpkWLFuif+6RCncnsb1NnjKnIIRY9KgebKkjCN5cs=";
17 };
18 "15" = {
19 version = "1.5";
20 hash = "sha256-RRSpkWLFuif+6RCncnsb1NnjKnIIRY9KgebKkjCN5cs=";
21 };
22 "16" = {
23 version = "1.5";
24 hash = "sha256-RRSpkWLFuif+6RCncnsb1NnjKnIIRY9KgebKkjCN5cs=";
25 };
26 "17" = {
27 version = "1.5";
28 hash = "sha256-RRSpkWLFuif+6RCncnsb1NnjKnIIRY9KgebKkjCN5cs=";
29 };
30 "18" = {
31 version = "1.5";
32 hash = "sha256-RRSpkWLFuif+6RCncnsb1NnjKnIIRY9KgebKkjCN5cs=";
33 };
34 };
35
36 source =
37 sources."${lib.versions.major postgresql.version}" or {
38 version = "";
39 hash = throw "pg_safeupdate: version specification for pg ${postgresql.version} missing.";
40 };
41in
42
43postgresqlBuildExtension {
44 pname = "pg-safeupdate";
45 inherit (source) version;
46
47 src = fetchFromGitHub {
48 owner = "eradman";
49 repo = "pg-safeupdate";
50 tag = source.version;
51 inherit (source) hash;
52 };
53
54 meta = {
55 broken = !builtins.elem (lib.versions.major postgresql.version) (builtins.attrNames sources);
56 description = "Simple extension to PostgreSQL that requires criteria for UPDATE and DELETE";
57 homepage = "https://github.com/eradman/pg-safeupdate";
58 changelog = "https://github.com/eradman/pg-safeupdate/raw/${source.version}/NEWS";
59 platforms = postgresql.meta.platforms;
60 maintainers = with lib.maintainers; [ wolfgangwalther ];
61 license = lib.licenses.postgresql;
62 };
63}