summaryrefslogtreecommitdiff
path: root/pkgs/servers/sql/postgresql/ext/pg_safeupdate.nix
blob: 7b9249ad64b1944d355d5a8ed868d861b5742294 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
  fetchFromGitHub,
  lib,
  postgresql,
  postgresqlBuildExtension,
}:

let
  sources = {
    "13" = {
      version = "1.4";
      hash = "sha256-1cyvVEC9MQGMr7Tg6EUbsVBrMc8ahdFS3+CmDkmAq4Y=";
    };
    "14" = {
      version = "1.5";
      hash = "sha256-RRSpkWLFuif+6RCncnsb1NnjKnIIRY9KgebKkjCN5cs=";
    };
    "15" = {
      version = "1.5";
      hash = "sha256-RRSpkWLFuif+6RCncnsb1NnjKnIIRY9KgebKkjCN5cs=";
    };
    "16" = {
      version = "1.5";
      hash = "sha256-RRSpkWLFuif+6RCncnsb1NnjKnIIRY9KgebKkjCN5cs=";
    };
    "17" = {
      version = "1.5";
      hash = "sha256-RRSpkWLFuif+6RCncnsb1NnjKnIIRY9KgebKkjCN5cs=";
    };
    "18" = {
      version = "1.5";
      hash = "sha256-RRSpkWLFuif+6RCncnsb1NnjKnIIRY9KgebKkjCN5cs=";
    };
  };

  source =
    sources."${lib.versions.major postgresql.version}" or {
      version = "";
      hash = throw "pg_safeupdate: version specification for pg ${postgresql.version} missing.";
    };
in

postgresqlBuildExtension {
  pname = "pg-safeupdate";
  inherit (source) version;

  src = fetchFromGitHub {
    owner = "eradman";
    repo = "pg-safeupdate";
    tag = source.version;
    inherit (source) hash;
  };

  meta = {
    broken = !builtins.elem (lib.versions.major postgresql.version) (builtins.attrNames sources);
    description = "Simple extension to PostgreSQL that requires criteria for UPDATE and DELETE";
    homepage = "https://github.com/eradman/pg-safeupdate";
    changelog = "https://github.com/eradman/pg-safeupdate/raw/${source.version}/NEWS";
    platforms = postgresql.meta.platforms;
    maintainers = with lib.maintainers; [ wolfgangwalther ];
    license = lib.licenses.postgresql;
  };
}