@@ -12,6 +12,17 @@ buildPgrxExtension_0_11_3 rec {
12
12
hash = "sha256-Q6XfcTKVOjo5pGy8QACc4QCHolKxEGU8e0TTC6Zg8go=" ;
13
13
} ;
14
14
15
+ # update the following array when the pg_graphql version is updated
16
+ # required to ensure that extensions update scripts from previous versions are generated
17
+ previousVersions = [
18
+ "1.5.6" "1.5.5" "1.5.4" "1.5.3" "1.5.2" "1.5.1" "1.5.0"
19
+ "1.4.4" "1.4.3" "1.4.2" "1.4.1" "1.4.0" "1.3.0" "1.2.3" "1.2.2"
20
+ "1.2.1" "1.2.0" "1.1.0" "1.0.2" "1.0.1" "1.0.0" "0.5.3"
21
+ "0.5.2" "0.5.0" "0.4.1" "0.4.0" "0.3.3" "0.3.2" "0.3.1"
22
+ "0.3.0" "0.2.1" "0.2.0" "0.1.5" "0.1.4" "0.1.3" "0.1.2"
23
+ "0.1.1" "0.1.0"
24
+ ] ;
25
+
15
26
nativeBuildInputs = [ cargo ] ;
16
27
buildInputs = [ postgresql ] ;
17
28
@@ -27,6 +38,30 @@ buildPgrxExtension_0_11_3 rec {
27
38
# to work, though
28
39
doCheck = false ;
29
40
41
+ preBuild = ''
42
+ echo "Processing git tags..."
43
+ echo '${ builtins . concatStringsSep "," previousVersions } ' | sed 's/,/\n/g' > git_tags.txt
44
+ '' ;
45
+
46
+ postInstall = ''
47
+ echo "Creating SQL files for previous versions..."
48
+ current_version="${ version } "
49
+ sql_file="$out/share/postgresql/extension/pg_graphql--$current_version.sql"
50
+
51
+ if [ -f "$sql_file" ]; then
52
+ while read -r previous_version; do
53
+ if [ "$(printf '%s\n' "$previous_version" "$current_version" | sort -V | head -n1)" = "$previous_version" ] && [ "$previous_version" != "$current_version" ]; then
54
+ new_file="$out/share/postgresql/extension/pg_graphql--$previous_version--$current_version.sql"
55
+ echo "Creating $new_file"
56
+ cp "$sql_file" "$new_file"
57
+ fi
58
+ done < git_tags.txt
59
+ else
60
+ echo "Warning: $sql_file not found"
61
+ fi
62
+ rm git_tags.txt
63
+ '' ;
64
+
30
65
meta = with lib ; {
31
66
description = "GraphQL support for PostreSQL" ;
32
67
homepage = "https://github.com/supabase/${ pname } " ;
0 commit comments