Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 7d501cee authored by Muhammad Rafif Elfazri's avatar Muhammad Rafif Elfazri
Browse files

Add Index for pagination cursor

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