Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfd72169

Browse files
jfrocheyvan-sraka
authored andcommitted
fix(pg_graphql): include unsupported versions as SQL-only for pg_upgrade compatibility
When upgrading PostgreSQL versions, pg_upgrade needs access to old extensionversions sql to migrate from. This adds unsupported pg_graphql versions (those notcompilable with current PostgreSQL) as SQL-only packages, ensuring migrationpaths exist when upgrading from older PostgreSQL versions.
1 parent238e95a commitfd72169

File tree

1 file changed

+48
-3
lines changed

1 file changed

+48
-3
lines changed

‎nix/ext/pg_graphql/default.nix‎

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ let
7979

8080
preCheck=''
8181
export PGRX_HOME="$(mktemp -d)"
82-
export PG_VERSION="${lib.versions.majorpostgresql.version}"
82+
export PG_VERSION="${pgVersion}"
8383
export NIX_PGLIBDIR="$PGRX_HOME/$PG_VERSION/lib"
8484
export PATH="$PGRX_HOME/$PG_VERSION/bin:$PATH"
8585
${lib.getExersync} --chmod=ugo+w -a${postgresql}/${postgresql.lib}/ "$PGRX_HOME/$PG_VERSION/"
@@ -119,19 +119,64 @@ let
119119
}
120120
);
121121
allVersions=(builtins.fromJSON(builtins.readFile../versions.json)).pg_graphql;
122+
pgVersion=lib.versions.majorpostgresql.version;
122123
supportedVersions=lib.filterAttrs(
123-
_:value:builtins.elem(lib.versions.majorpostgresql.version)value.postgresql
124+
_:value:builtins.elempgVersionvalue.postgresql
124125
)allVersions;
125126
versions=lib.naturalSort(lib.attrNamessupportedVersions);
126127
latestVersion=lib.lastversions;
127128
numberOfVersions=builtins.lengthversions;
128129
packages=builtins.attrValues(
129130
lib.mapAttrs(name:value:buildnamevalue.hashvalue.rustvalue.pgrx)supportedVersions
130131
);
132+
buildUnsupported=
133+
# Build SQL-only packages for unsupported versions needed by pg_upgrade.
134+
# When upgrading PostgreSQL, pg_upgrade requires old extension versions to exist
135+
# even if they can't compile against the new PostgreSQL version.
136+
version:hash:_rustVersion:_pgrxVersion:
137+
stdenv.mkDerivation{
138+
inheritpnameversion;
139+
src=fetchFromGitHub{
140+
owner="supabase";
141+
repo=pname;
142+
rev="v${version}";
143+
inherithash;
144+
};
145+
phases=["installPhase"];
146+
installPhase=''
147+
mkdir -p $out/share/postgresql/extension
148+
for file in $src/sql/*.sql; do
149+
filename=$(basename "$file")
150+
if [[ "$filename" != "load_sql_config.sql" && "$filename" != "load_sql_context.sql" ]]; then
151+
cat "$file"
152+
echo ";"
153+
fi
154+
done > $out/share/postgresql/extension/${pname}--${version}.sql
155+
'';
156+
meta=withlib;{
157+
description="GraphQL support for PostreSQL";
158+
homepage="https://github.com/supabase/${pname}";
159+
license=licenses.postgresql;
160+
inherit(postgresql.meta)platforms;
161+
};
162+
};
163+
unsupportedVersions=lib.filterAttrs(
164+
_:value:!builtins.elempgVersionvalue.postgresql
165+
)allVersions;
166+
unsupportedPackages=
167+
ifpgVersion==15then
168+
[]
169+
else
170+
# Include SQL-only packages for PG15 extension versions incompatible with current PG
171+
builtins.attrValues(
172+
lib.mapAttrs(
173+
name:value:buildUnsupportednamevalue.hashvalue.rustvalue.pgrx
174+
)unsupportedVersions
175+
);
131176
in
132177
buildEnv{
133178
name=pname;
134-
paths=packages;
179+
paths=packages++unsupportedPackages;
135180
pathsToLink=[
136181
"/lib"
137182
"/share/postgresql/extension"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp