mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-12 03:56:17 +03:00
Merge pull request #286377 from marsam/add-pg_squeeze
postgresqlPackages.pg_squeeze: init at 1.5.2
This commit is contained in:
commit
11bc6db582
67
pkgs/servers/sql/postgresql/ext/pg_squeeze.nix
Normal file
67
pkgs/servers/sql/postgresql/ext/pg_squeeze.nix
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
{ lib, stdenv, fetchFromGitHub, postgresql, postgresqlTestHook }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
|
pname = "pg_squeeze";
|
||||||
|
version = "1.5.2";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "cybertec-postgresql";
|
||||||
|
repo = "pg_squeeze";
|
||||||
|
rev = finalAttrs.version;
|
||||||
|
hash = "sha256-Sa5mVaUhuRHUjbcORVXe+3uwI1RxfsL6zaZixtU0BcU=";
|
||||||
|
};
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
postgresql
|
||||||
|
];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
install -D -t $out/lib pg_squeeze${postgresql.dlSuffix}
|
||||||
|
install -D -t $out/share/postgresql/extension pg_squeeze-*.sql
|
||||||
|
install -D -t $out/share/postgresql/extension pg_squeeze.control
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru.tests.extension = stdenv.mkDerivation {
|
||||||
|
name = "pg_squeeze-test";
|
||||||
|
dontUnpack = true;
|
||||||
|
doCheck = true;
|
||||||
|
nativeCheckInputs = [ postgresqlTestHook (postgresql.withPackages (_: [ finalAttrs.finalPackage ])) ];
|
||||||
|
failureHook = "postgresqlStop";
|
||||||
|
postgresqlTestUserOptions = "LOGIN SUPERUSER";
|
||||||
|
postgresqlExtraSettings = ''
|
||||||
|
wal_level = logical
|
||||||
|
shared_preload_libraries = 'pg_squeeze'
|
||||||
|
'';
|
||||||
|
passAsFile = [ "sql" ];
|
||||||
|
sql = ''
|
||||||
|
CREATE EXTENSION pg_squeeze;
|
||||||
|
|
||||||
|
SELECT squeeze.start_worker();
|
||||||
|
|
||||||
|
CREATE TABLE a(i int PRIMARY KEY, j int);
|
||||||
|
INSERT INTO a(i, j) SELECT x, x FROM generate_series(1, 20) AS g(x);
|
||||||
|
INSERT INTO squeeze.tables (tabschema, tabname, schedule)
|
||||||
|
VALUES ('public', 'a', ('{30}', '{22}', NULL, NULL, '{3, 5}'));
|
||||||
|
SELECT squeeze.squeeze_table('public', 'a', NULL, NULL, NULL);
|
||||||
|
'';
|
||||||
|
checkPhase = ''
|
||||||
|
runHook preCheck
|
||||||
|
psql -a -v ON_ERROR_STOP=1 -f $sqlPath
|
||||||
|
runHook postCheck
|
||||||
|
'';
|
||||||
|
installPhase = "touch $out";
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "A PostgreSQL extension for automatic bloat cleanup";
|
||||||
|
homepage = "https://github.com/cybertec-postgresql/pg_squeeze";
|
||||||
|
changelog = "https://github.com/cybertec-postgresql/pg_squeeze/blob/${finalAttrs.src.rev}/NEWS";
|
||||||
|
license = licenses.mit;
|
||||||
|
maintainers = [ maintainers.marsam ];
|
||||||
|
platforms = postgresql.meta.platforms;
|
||||||
|
};
|
||||||
|
})
|
@ -87,6 +87,8 @@ self: super: {
|
|||||||
|
|
||||||
pg_safeupdate = super.callPackage ./ext/pg_safeupdate.nix { };
|
pg_safeupdate = super.callPackage ./ext/pg_safeupdate.nix { };
|
||||||
|
|
||||||
|
pg_squeeze = super.callPackage ./ext/pg_squeeze.nix { };
|
||||||
|
|
||||||
pg_uuidv7 = super.callPackage ./ext/pg_uuidv7.nix { };
|
pg_uuidv7 = super.callPackage ./ext/pg_uuidv7.nix { };
|
||||||
|
|
||||||
promscale_extension = super.callPackage ./ext/promscale_extension.nix { };
|
promscale_extension = super.callPackage ./ext/promscale_extension.nix { };
|
||||||
|
Loading…
Reference in New Issue
Block a user