defmodule DaProductApp.Stores.Store do use Ecto.Schema import Ecto.Changeset alias DaProductApp.Brand schema "stores" do field :code, :string field :name, :string field :neo_merchant_id, :string # Add this field belongs_to :brand, Brand belongs_to :address, DaProductApp.Address timestamps() end def changeset(store, attrs) do store |> cast(attrs, [:code, :name, :brand_id, :neo_merchant_id, :address_id]) |> validate_required([:code, :name, :brand_id]) end end