Add an unique index on posts URLs

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-06-22 16:50:58 +02:00
parent 8caf1e302b
commit 7bb8568504
4 changed files with 108 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
defmodule Mobilizon.Storage.Repo.Migrations.AddIndexToPosts do
use Ecto.Migration
def up do
create_if_not_exists(unique_index("posts", [:url]))
end
def down do
drop_if_exists(index("posts", [:url]))
end
end