Fakultas Ilmu Komputer UI

Commit 7d501cee authored by Muhammad Rafif Elfazri's avatar Muhammad Rafif Elfazri
Browse files

Add Index for pagination cursor

parent 80e24443
...@@ -8,6 +8,7 @@ defmodule Diskuy.Repo.Migrations.CreateUsers do ...@@ -8,6 +8,7 @@ defmodule Diskuy.Repo.Migrations.CreateUsers do
add :picture, :string add :picture, :string
timestamps() timestamps()
end end
create index(:users, [:id, :inserted_at])
create unique_index(:users, [:username]) create unique_index(:users, [:username])
create unique_index(:users, [:email]) create unique_index(:users, [:email])
end end
......
...@@ -7,6 +7,7 @@ defmodule Diskuy.Repo.Migrations.CreateTopics do ...@@ -7,6 +7,7 @@ defmodule Diskuy.Repo.Migrations.CreateTopics do
timestamps() timestamps()
end end
create index(:topics, [:id, :inserted_at])
create unique_index(:topics, [:name]) create unique_index(:topics, [:name])
end end
end end
...@@ -14,6 +14,7 @@ defmodule Diskuy.Repo.Migrations.CreateThreads do ...@@ -14,6 +14,7 @@ defmodule Diskuy.Repo.Migrations.CreateThreads do
create index(:threads, [:topic_id]) create index(:threads, [:topic_id])
create index(:threads, [:user_id]) create index(:threads, [:user_id])
create index(:threads, [:id, :inserted_at])
create unique_index(:threads, [:title, :topic_id], name: :title_in_topic_unique) create unique_index(:threads, [:title, :topic_id], name: :title_in_topic_unique)
end end
end end
...@@ -12,6 +12,7 @@ defmodule Diskuy.Repo.Migrations.CreatePosts do ...@@ -12,6 +12,7 @@ defmodule Diskuy.Repo.Migrations.CreatePosts do
timestamps() timestamps()
end end
create index(:posts, [:id, :inserted_at])
create index(:posts, [:thread_id]) create index(:posts, [:thread_id])
create index(:posts, [:user_id]) create index(:posts, [:user_id])
end end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment