Skip to content

Commit 0209821

Browse files
committed
add new fields & indexes
1 parent 3c09eec commit 0209821

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
defmodule Algora.Repo.Migrations.AddPerformanceIndexes do
2+
use Ecto.Migration
3+
4+
def change do
5+
# Index for provider_meta->>'followers' queries (used in talent matching)
6+
create index(:users, ["((provider_meta->>'followers')::int)"], name: :users_provider_meta_followers_idx)
7+
8+
# Index for country filtering (frequently used in candidates/talents queries)
9+
create index(:users, [:country], where: "country IS NOT NULL", name: :users_country_idx)
10+
11+
# Index for location_iso_lvl4 filtering
12+
create index(:users, [:location_iso_lvl4], where: "location_iso_lvl4 IS NOT NULL", name: :users_location_iso_lvl4_idx)
13+
14+
# Index for min_compensation (used in sorting)
15+
create index(:users, [:min_compensation], where: "min_compensation IS NOT NULL", name: :users_min_compensation_idx)
16+
17+
# Composite index for common talent queries
18+
create index(:users, [:country, :min_compensation],
19+
where: "country IS NOT NULL AND min_compensation IS NOT NULL",
20+
name: :users_country_min_compensation_idx)
21+
22+
# Index for language_contributions user_id lookups
23+
create index(:language_contributions, [:user_id, :percentage], name: :language_contributions_user_id_percentage_idx)
24+
25+
# Index for user_contributions filtering on user_id
26+
create index(:user_contributions, [:user_id, :contribution_count], name: :user_contributions_user_id_contribution_count_idx)
27+
end
28+
end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
defmodule Algora.Repo.Migrations.AddProviderLoginIndex do
2+
use Ecto.Migration
3+
4+
def change do
5+
create index(:users, [:provider_login])
6+
end
7+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
defmodule Algora.Repo.Migrations.AddBachelorGraduationYearToUsers do
2+
use Ecto.Migration
3+
4+
def change do
5+
alter table(:users) do
6+
add :grad_year, :integer
7+
end
8+
end
9+
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
defmodule Algora.Repo.Migrations.AddGradYearIndex do
2+
use Ecto.Migration
3+
4+
@disable_ddl_transaction true
5+
@disable_migration_lock true
6+
7+
def change do
8+
create index(:users, [:grad_year], where: "grad_year IS NOT NULL", concurrently: true)
9+
end
10+
end

0 commit comments

Comments
 (0)