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
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
......
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