Skip to content

Commit e6f4046

Browse files
committed
chore: move nix prev version to a static list
1 parent 0721540 commit e6f4046

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

nix/ext/wrappers/default.nix

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ in
1919
buildPgrxExtension_0_11_3 rec {
2020
pname = "supabase-wrappers";
2121
version = "0.4.1";
22+
# update this when the wrappers version is updated
23+
# required to ensure that extensions update scripts from previous versions are generated
24+
previousVersions = ["0.4.0" "0.3.1" "0.3.0" "0.2.0" "0.1.19" "0.1.18" "0.1.17" "0.1.16" "0.1.15" "0.1.14" "0.1.12" "0.1.11" "0.1.10" "0.1.9" "0.1.8" "0.1.7" "0.1.6" "0.1.5" "0.1.4" "0.1.1" "0.1.0"];
2225
inherit postgresql;
2326
src = fetchFromGitHub {
2427
owner = "supabase";
@@ -62,7 +65,7 @@ buildPgrxExtension_0_11_3 rec {
6265

6366
preBuild = ''
6467
echo "Processing git tags..."
65-
echo '${builtins.toJSON gitTags}' | ${jq}/bin/jq -r '.[].name' | sort -rV > git_tags.txt
68+
echo '${concatStringsSep "," previousVersions }' | sed 's/,/\n/g' > git_tags.txt
6669
'';
6770

6871
postInstall = ''
@@ -71,10 +74,9 @@ buildPgrxExtension_0_11_3 rec {
7174
sql_file="$out/share/postgresql/extension/wrappers--$current_version.sql"
7275
7376
if [ -f "$sql_file" ]; then
74-
while read -r tag; do
75-
tag_version=$(echo "$tag" | sed 's/^v//')
76-
if [ "$(printf '%s\n' "$tag_version" "$current_version" | sort -V | head -n1)" = "$tag_version" ] && [ "$tag_version" != "$current_version" ]; then
77-
new_file="$out/share/postgresql/extension/wrappers--$tag_version--$current_version.sql"
77+
while read -r previous_version; do
78+
if [ "$(printf '%s\n' "$previous_version" "$current_version" | sort -V | head -n1)" = "$previous_version" ] && [ "$previous_version" != "$current_version" ]; then
79+
new_file="$out/share/postgresql/extension/wrappers--$previous_version--$current_version.sql"
7880
echo "Creating $new_file"
7981
cp "$sql_file" "$new_file"
8082
fi

0 commit comments

Comments
 (0)