mirror of
https://github.com/kieraneglin/pinchflat.git
synced 2026-01-23 02:24:24 +00:00
Improved index to respect nulls
This commit is contained in:
parent
4e26253b33
commit
3daf72a161
3 changed files with 16 additions and 4 deletions
|
|
@ -1,7 +1,19 @@
|
|||
defmodule Pinchflat.Repo.Migrations.ReReAddSourceUniquenessIndex do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create unique_index(:sources, [:collection_id, :media_profile_id, :title_filter_regex])
|
||||
def up do
|
||||
execute """
|
||||
CREATE UNIQUE INDEX sources_collection_id_media_profile_id_title_filter_regex_index ON sources (
|
||||
collection_id,
|
||||
media_profile_id,
|
||||
IFNULL(title_filter_regex, '')
|
||||
);
|
||||
"""
|
||||
end
|
||||
|
||||
def down do
|
||||
execute """
|
||||
DROP INDEX sources_collection_id_media_profile_id_title_filter_regex_index;
|
||||
"""
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue