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 = "1.9.1";
13
14 src = fetchFromGitHub {
15 owner = "cybertec-postgresql";
16 repo = "pg_squeeze";
17 tag = "REL${lib.replaceString "." "_" finalAttrs.version}";
18 hash = "sha256-KbCS3kg2MoxKHl+35UOFCSF4kPPsIMeO7AfwfHZYZVg=";
19 };
20
21 passthru.updateScript = nix-update-script {
22 extraArgs = [ "--version-regex=^REL(\\d+)_(\\d+)_(\\d+)$" ];
23 };
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})