From 8a402d5059fc8344f871ae86ec7a0062cfa76626 Mon Sep 17 00:00:00 2001 From: Juan Carlos Heredia Date: Mon, 1 Apr 2024 16:34:10 +0200 Subject: [PATCH 1/5] Add composite index to positions on odometer and car_id --- ...0416250000_composite_index_to_positions_on_odometer.exs | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 priv/repo/migrations/20240416250000_composite_index_to_positions_on_odometer.exs diff --git a/priv/repo/migrations/20240416250000_composite_index_to_positions_on_odometer.exs b/priv/repo/migrations/20240416250000_composite_index_to_positions_on_odometer.exs new file mode 100644 index 0000000000..6456723985 --- /dev/null +++ b/priv/repo/migrations/20240416250000_composite_index_to_positions_on_odometer.exs @@ -0,0 +1,7 @@ +defmodule TeslaMate.Repo.Migrations.AddCompositeIndexToPositionsOnOdometer do + use Ecto.Migration + + def change do + create index(:positions, [:odometer, :car_id]) + end +end From 29ebf54969db4f339a980c0050996216d5f63e03 Mon Sep 17 00:00:00 2001 From: Juan Carlos Heredia Date: Mon, 1 Apr 2024 16:38:42 +0200 Subject: [PATCH 2/5] Update timestamp --- ... 202404161637000_composite_index_to_positions_on_odometer.exs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename priv/repo/migrations/{20240416250000_composite_index_to_positions_on_odometer.exs => 202404161637000_composite_index_to_positions_on_odometer.exs} (100%) diff --git a/priv/repo/migrations/20240416250000_composite_index_to_positions_on_odometer.exs b/priv/repo/migrations/202404161637000_composite_index_to_positions_on_odometer.exs similarity index 100% rename from priv/repo/migrations/20240416250000_composite_index_to_positions_on_odometer.exs rename to priv/repo/migrations/202404161637000_composite_index_to_positions_on_odometer.exs From e44702bbcf24cd1c67b2d12a31456f2b9dd4e833 Mon Sep 17 00:00:00 2001 From: Juan Carlos Heredia Date: Mon, 1 Apr 2024 17:56:09 +0200 Subject: [PATCH 3/5] update order --- ...202404161637000_composite_index_to_positions_on_odometer.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/priv/repo/migrations/202404161637000_composite_index_to_positions_on_odometer.exs b/priv/repo/migrations/202404161637000_composite_index_to_positions_on_odometer.exs index 6456723985..9d078457be 100644 --- a/priv/repo/migrations/202404161637000_composite_index_to_positions_on_odometer.exs +++ b/priv/repo/migrations/202404161637000_composite_index_to_positions_on_odometer.exs @@ -2,6 +2,6 @@ defmodule TeslaMate.Repo.Migrations.AddCompositeIndexToPositionsOnOdometer do use Ecto.Migration def change do - create index(:positions, [:odometer, :car_id]) + create index(:positions, [car_id:, :odometer]) end end From e09ad7b0d05939215fdba7b2503cda1b191b5222 Mon Sep 17 00:00:00 2001 From: Juan Carlos Heredia Date: Mon, 1 Apr 2024 18:08:17 +0200 Subject: [PATCH 4/5] Update formatting --- ...202404161637000_composite_index_to_positions_on_odometer.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/priv/repo/migrations/202404161637000_composite_index_to_positions_on_odometer.exs b/priv/repo/migrations/202404161637000_composite_index_to_positions_on_odometer.exs index 9d078457be..2e6d6d712d 100644 --- a/priv/repo/migrations/202404161637000_composite_index_to_positions_on_odometer.exs +++ b/priv/repo/migrations/202404161637000_composite_index_to_positions_on_odometer.exs @@ -2,6 +2,6 @@ defmodule TeslaMate.Repo.Migrations.AddCompositeIndexToPositionsOnOdometer do use Ecto.Migration def change do - create index(:positions, [car_id:, :odometer]) + create index(:positions, [:car_id:, :odometer]) end end From b9f340bc3aa4a57b1f7e7cb19f49d320400759f2 Mon Sep 17 00:00:00 2001 From: Juan Carlos Heredia Date: Mon, 1 Apr 2024 18:14:11 +0200 Subject: [PATCH 5/5] Fix formatting --- ...202404161637000_composite_index_to_positions_on_odometer.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/priv/repo/migrations/202404161637000_composite_index_to_positions_on_odometer.exs b/priv/repo/migrations/202404161637000_composite_index_to_positions_on_odometer.exs index 2e6d6d712d..07889c0b61 100644 --- a/priv/repo/migrations/202404161637000_composite_index_to_positions_on_odometer.exs +++ b/priv/repo/migrations/202404161637000_composite_index_to_positions_on_odometer.exs @@ -2,6 +2,6 @@ defmodule TeslaMate.Repo.Migrations.AddCompositeIndexToPositionsOnOdometer do use Ecto.Migration def change do - create index(:positions, [:car_id:, :odometer]) + create index(:positions, [:car_id, :odometer]) end end