Skip to content

Commit 8d32169

Browse files
authored
feat: keep pgjwt present but deactivated for orioledb only to avoid r… (#1557)
* feat: keep pgjwt present but deactivated for orioledb only to avoid restore issues * feat: adjust to only create for pg 15.x * feat: rm legacy manipulation of schema and just use what is generated 1:1 * test: recreate schemas for this branch after rebase * chore: bump suffix to try and build again due to timeout * chore: bump versions for release to fix oriole pause restore
1 parent 70b1181 commit 8d32169

File tree

8 files changed

+35
-41
lines changed

8 files changed

+35
-41
lines changed

ansible/vars.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ postgres_major:
99

1010
# Full version strings for each major version
1111
postgres_release:
12-
postgresorioledb-17: "17.0.1.067-orioledb"
13-
postgres17: "17.4.1.017"
14-
postgres15: "15.8.1.074"
12+
postgresorioledb-17: "17.0.1.068-orioledb"
13+
postgres17: "17.4.1.018"
14+
postgres15: "15.8.1.075"
1515

1616
# Non Postgres Extensions
1717
pgbouncer_release: "1.19.0"

flake.nix

+5-3
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,14 @@
154154
x:
155155
x != ./nix/ext/timescaledb.nix &&
156156
x != ./nix/ext/timescaledb-2.9.1.nix &&
157-
x != ./nix/ext/plv8.nix &&
158-
x != ./nix/ext/pgjwt.nix
157+
x != ./nix/ext/plv8.nix
159158
) ourExtensions;
160159

161160
orioledbExtensions = orioleFilteredExtensions ++ [ ./nix/ext/orioledb.nix ];
162-
dbExtensions17 = orioleFilteredExtensions;
161+
dbExtensions17 = builtins.filter (
162+
x:
163+
x != ./nix/ext/pgjwt.nix
164+
) orioleFilteredExtensions;
163165
getPostgresqlPackage = version:
164166
pkgs.postgresql."postgresql_${version}";
165167
# Create a 'receipt' file for a given postgresql package. This is a way

migrations/db/init-scripts/00000000000000-initial-schema.sql

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ do $$
2222
begin
2323
if exists (select 1 from pg_available_extensions where name = 'pgjwt') then
2424
if not exists (select 1 from pg_extension where extname = 'pgjwt') then
25-
create extension if not exists pgjwt with schema "extensions" cascade;
25+
if current_setting('server_version_num')::int / 10000 = 15 then
26+
create extension if not exists pgjwt with schema "extensions" cascade;
27+
end if;
2628
end if;
2729
end if;
2830
end $$;

migrations/schema-15.sql

+7-7
Original file line numberDiff line numberDiff line change
@@ -495,13 +495,13 @@ begin
495495
raise debug 'PgBouncer auth request: %', p_usename;
496496

497497
return query
498-
select
499-
rolname::text,
500-
case when rolvaliduntil < now()
501-
then null
502-
else rolpassword::text
503-
end
504-
from pg_authid
498+
select
499+
rolname::text,
500+
case when rolvaliduntil < now()
501+
then null
502+
else rolpassword::text
503+
end
504+
from pg_authid
505505
where rolname=$1 and rolcanlogin;
506506
end;
507507
$_$;

migrations/schema-17.sql

+7-7
Original file line numberDiff line numberDiff line change
@@ -482,13 +482,13 @@ begin
482482
raise debug 'PgBouncer auth request: %', p_usename;
483483

484484
return query
485-
select
486-
rolname::text,
487-
case when rolvaliduntil < now()
488-
then null
489-
else rolpassword::text
490-
end
491-
from pg_authid
485+
select
486+
rolname::text,
487+
case when rolvaliduntil < now()
488+
then null
489+
else rolpassword::text
490+
end
491+
from pg_authid
492492
where rolname=$1 and rolcanlogin;
493493
end;
494494
$_$;

migrations/schema-orioledb-17.sql

+7-7
Original file line numberDiff line numberDiff line change
@@ -496,13 +496,13 @@ begin
496496
raise debug 'PgBouncer auth request: %', p_usename;
497497

498498
return query
499-
select
500-
rolname::text,
501-
case when rolvaliduntil < now()
502-
then null
503-
else rolpassword::text
504-
end
505-
from pg_authid
499+
select
500+
rolname::text,
501+
case when rolvaliduntil < now()
502+
then null
503+
else rolpassword::text
504+
end
505+
from pg_authid
506506
where rolname=$1 and rolcanlogin;
507507
end;
508508
$_$;

nix/tests/prime.sql

+3-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ do $$
6161
begin
6262
if exists (select 1 from pg_available_extensions where name = 'pgjwt') then
6363
if not exists (select 1 from pg_extension where extname = 'pgjwt') then
64-
create extension if not exists pgjwt;
64+
if current_setting('server_version_num')::int / 10000 = 15 then
65+
create extension if not exists pgjwt;
66+
end if;
6567
end if;
6668
end if;
6769
end $$;

nix/tools/dbmate-tool.sh.in

-12
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,6 @@ check_orioledb_ready() {
170170
return 1
171171
}
172172

173-
trim_schema() {
174-
case "$CURRENT_SYSTEM" in
175-
"x86_64-darwin"|"aarch64-darwin")
176-
sed -i '' '/INSERT INTO public.schema_migrations/,$d' "./db/schema.sql"
177-
echo "Matched: $CURRENT_SYSTEM"
178-
;;
179-
*)
180-
sed -i '/INSERT INTO public.schema_migrations/,$d' "./db/schema.sql"
181-
;;
182-
esac
183-
}
184-
185173
perform_dump() {
186174
local max_attempts=3
187175
local attempt=1

0 commit comments

Comments
 (0)