diff --git a/apps/nerves_hub_web_core/lib/nerves_hub_web_core/products/product.ex b/apps/nerves_hub_web_core/lib/nerves_hub_web_core/products/product.ex index dfd6d9402..95f59a285 100644 --- a/apps/nerves_hub_web_core/lib/nerves_hub_web_core/products/product.ex +++ b/apps/nerves_hub_web_core/lib/nerves_hub_web_core/products/product.ex @@ -19,7 +19,7 @@ defmodule NervesHubWebCore.Products.Product do has_many(:firmwares, Firmware) has_many(:product_users, ProductUser) has_many(:users, through: [:product_users, :user]) - has_one(:jitp, CACertificate.JITP) + has_many(:jitp, CACertificate.JITP) belongs_to(:org, Org, where: [deleted_at: nil]) diff --git a/apps/nerves_hub_web_core/priv/repo/migrations/20221220101029_remove_jitp_product_uniqueness.exs b/apps/nerves_hub_web_core/priv/repo/migrations/20221220101029_remove_jitp_product_uniqueness.exs new file mode 100644 index 000000000..bb7513790 --- /dev/null +++ b/apps/nerves_hub_web_core/priv/repo/migrations/20221220101029_remove_jitp_product_uniqueness.exs @@ -0,0 +1,7 @@ +defmodule NervesHubWebCore.Repo.Migrations.RemoveJitpProductUniqueness do + use Ecto.Migration + + def change do + drop unique_index(:jitp, [:product_id]) + end +end