Unverified Commit 398000e6 authored by Josha Inglis's avatar Josha Inglis
Browse files

postgresqlPackages.pgddl: init at 0.29

parent 65b3b59f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -116,6 +116,8 @@ in {
    tsja = super.callPackage ./tsja.nix { };

    wal2json = super.callPackage ./wal2json.nix { };

    pgddl = super.callPackage ./pgddl.nix {};
} // lib.optionalAttrs config.allowAliases {
  pg_embedding = throw "PostgreSQL extension `pg_embedding` has been removed since the project has been abandoned. Upstream's recommendation is to use pgvector instead (https://neon.tech/docs/extensions/pg_embedding#migrate-from-pg_embedding-to-pgvector)";
}
+52 −0
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  postgresql,
  buildPostgresqlExtension,
  postgresqlTestExtension,
  perl,
}:
buildPostgresqlExtension (finalAttrs: {
  pname = "pgddl";
  version = "0.29";

  src = fetchFromGitHub {
    owner = "lacanoid";
    repo = "pgddl";
    tag = finalAttrs.version;
    hash = "sha256-W3G6TGtkj+zXXdGZZR0bmZhsLuFJvuGTlDoo8kL8sf0=";
  };

  strictDeps = true;

  nativeBuildInputs = [
    postgresql
    perl
  ];

  preBuild = ''
    patchShebangs --build ./bin/ ./docs
  '';

  passthru.tests.extension = postgresqlTestExtension {
    inherit (finalAttrs) finalPackage;
    sql = ''
      CREATE EXTENSION ddlx;

      CREATE TABLE a(i int PRIMARY KEY, j int);

      SELECT ddlx_create('a'::regclass);
      SELECT ddlx_drop('a'::regclass);
      SELECT ddlx_script('a'::regclass);
    '';
  };

  meta = {
    description = "DDL eXtractor functions for PostgreSQL";
    homepage = "https://github.com/lacanoid/pgddl";
    changelog = "https://github.com/lacanoid/pgddl/releases/tag/${finalAttrs.version}";
    platforms = postgresql.meta.platforms;
    maintainers = [ lib.maintainers.joshainglis ];
    license = lib.licenses.postgresql;
  };
})