1{
2 fetchFromGitHub,
3 lib,
4 nix-update-script,
5 postgresql,
6 postgresqlBuildExtension,
7 postgresqlTestExtension,
8}:
9
10postgresqlBuildExtension (finalAttrs: {
11 pname = "pg_squeeze";
12 version = "${builtins.replaceStrings [ "_" ] [ "." ] (
13 lib.strings.removePrefix "REL" finalAttrs.src.rev
14 )}";
15
16 src = fetchFromGitHub {
17 owner = "cybertec-postgresql";
18 repo = "pg_squeeze";
19 tag = "REL1_7_0";
20 hash = "sha256-Kh1wSOvV5Rd1CG/na3yzbWzvaR8SJ6wmTZOnM+lbgik=";
21 };
22
23 passthru.updateScript = nix-update-script { extraArgs = [ "--version-regex=REL(.*)" ]; };
24 passthru.tests.extension = postgresqlTestExtension {
25 inherit (finalAttrs) finalPackage;
26 postgresqlExtraSettings = ''
27 wal_level = logical
28 shared_preload_libraries = 'pg_squeeze'
29 '';
30 sql = ''
31 CREATE EXTENSION pg_squeeze;
32
33 SELECT squeeze.start_worker();
34
35 CREATE TABLE a(i int PRIMARY KEY, j int);
36 INSERT INTO a(i, j) SELECT x, x FROM generate_series(1, 20) AS g(x);
37 INSERT INTO squeeze.tables (tabschema, tabname, schedule)
38 VALUES ('public', 'a', ('{30}', '{22}', NULL, NULL, '{3, 5}'));
39 SELECT squeeze.squeeze_table('public', 'a', NULL, NULL, NULL);
40 '';
41 };
42
43 meta = {
44 description = "PostgreSQL extension for automatic bloat cleanup";
45 homepage = "https://github.com/cybertec-postgresql/pg_squeeze";
46 changelog = "https://github.com/cybertec-postgresql/pg_squeeze/blob/${finalAttrs.src.rev}/NEWS";
47 license = lib.licenses.mit;
48 maintainers = [ ];
49 platforms = postgresql.meta.platforms;
50 };
51})