Условный индекс в Postgres
add_index :table_name, :columns, unique: true, where: "(deleted_at IS NULL)"
Confused Cassowary
add_index :table_name, :columns, unique: true, where: "(deleted_at IS NULL)"