feat: postgres hooks

This commit is contained in:
2026-04-30 21:59:53 +00:00
parent bf7ee34716
commit 3d5e3fdb36
8 changed files with 127 additions and 132 deletions

View File

@@ -1,4 +1,4 @@
{ dash, hectic, sqlite, postgresql_17, gawk }:
{ dash, hectic, sqlite, postgresql_17, gawk, runCommand, self }:
let
shell = "${dash}/bin/dash";
bashOptions = [
@@ -6,6 +6,21 @@ let
"nounset"
];
hecticVersionSqlFile = runCommand "hectic-version.sql" {
text = self.lib.hectic.version.sql;
passAsFile = [ "text" ];
} ''cp "$textPath" "$out"'';
hecticEnv = ''
HECTIC_VERSION_SQL=${hecticVersionSqlFile}
HECTIC_SECRET_SQL=${self.lib.hectic.secret.path}
HECTIC_MIGRATION_SQL=${self.lib.hectic.migration.path}
HECTIC_INHERITANCE_SQL=${self.lib.hectic.inheritance.path}
export HECTIC_VERSION_SQL HECTIC_SECRET_SQL HECTIC_MIGRATION_SQL HECTIC_INHERITANCE_SQL
'';
applyBundle = builtins.readFile self.lib.hectic.applyBundleScript;
migrator = hectic.writeShellApplication {
inherit shell bashOptions;
name = "migrator";
@@ -13,6 +28,8 @@ let
text = ''
${builtins.readFile hectic.helpers.posix-shell.log}
${hecticEnv}
${applyBundle}
${builtins.readFile ./migrator.sh}
'';
};