From 70cb96dc96e208e4a95eb997e5604598e645bece Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 7 Apr 2022 10:46:26 +0200 Subject: [PATCH] Add spatial indexes on address table Signed-off-by: Thomas Citharel --- .../20220407083712_add_indexes_to_addresses.exs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 priv/repo/migrations/20220407083712_add_indexes_to_addresses.exs diff --git a/priv/repo/migrations/20220407083712_add_indexes_to_addresses.exs b/priv/repo/migrations/20220407083712_add_indexes_to_addresses.exs new file mode 100644 index 000000000..9ba7dd112 --- /dev/null +++ b/priv/repo/migrations/20220407083712_add_indexes_to_addresses.exs @@ -0,0 +1,13 @@ +defmodule Mobilizon.Storage.Repo.Migrations.AddIndexesToAddresses do + use Ecto.Migration + + def up do + create_if_not_exists(index("addresses", ["st_x(geom)"], name: "idx_addresses_geom_x")) + create_if_not_exists(index("addresses", ["st_y(geom)"], name: "idx_addresses_geom_y")) + end + + def down do + drop_if_exists(index("addresses", ["st_x(geom)"], name: "idx_addresses_geom_x")) + drop_if_exists(index("addresses", ["st_y(geom)"], name: "idx_addresses_geom_y")) + end +end