Skip to content

Commit 2de5913

Browse files
committed
fix: restore earthdistance function search paths
Reapply the public search_path for ll_to_earth and earth_box after the earthdistance extension upgrade. TeslaMate previously set these functions to use the public schema to avoid lookup errors around the earth type. The later earthdistance update migration upgrades the extension but does not restore that custom function metadata, which can leave the functions without the expected search path. This adds a follow-up migration that sets the search path for both functions back to public and updates restore documentation to include these changes. Signed-off-by: Ben Hale <nebhale@nebhale.com>
1 parent e9ddcab commit 2de5913

4 files changed

Lines changed: 18 additions & 0 deletions

File tree

nix/backup_and_restore.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ let
2525
create schema public;
2626
CREATE EXTENSION cube WITH SCHEMA public;
2727
CREATE EXTENSION earthdistance WITH SCHEMA public;
28+
ALTER FUNCTION ll_to_earth SET search_path = public;
29+
ALTER FUNCTION earth_box SET search_path = public;
2830
.
2931
3032
# Restore
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
defmodule TeslaMate.Repo.Migrations.SetSearchPathForEarthdistanceFunctions do
2+
use Ecto.Migration
3+
4+
def up do
5+
execute("ALTER FUNCTION ll_to_earth SET search_path = public")
6+
execute("ALTER FUNCTION earth_box SET search_path = public")
7+
end
8+
9+
def down do
10+
:ok
11+
end
12+
end

website/docs/installation/unsupported/unraid.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ DROP SCHEMA private CASCADE;
187187
CREATE SCHEMA public;
188188
CREATE EXTENSION cube WITH SCHEMA public;
189189
CREATE EXTENSION earthdistance WITH SCHEMA public;
190+
ALTER FUNCTION ll_to_earth SET search_path = public;
191+
ALTER FUNCTION earth_box SET search_path = public;
190192
SQL
191193

192194
if [ $? -ne 0 ]; then

website/docs/maintenance/backup_restore.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ DROP SCHEMA private CASCADE;
8080
CREATE SCHEMA public;
8181
CREATE EXTENSION cube WITH SCHEMA public;
8282
CREATE EXTENSION earthdistance WITH SCHEMA public;
83+
ALTER FUNCTION ll_to_earth SET search_path = public;
84+
ALTER FUNCTION earth_box SET search_path = public;
8385
.
8486

8587
# Restore

0 commit comments

Comments
 (0)