diff --git a/lib/code_corps/model/project.ex b/lib/code_corps/model/project.ex index 7d08c5d74..b45f8d199 100644 --- a/lib/code_corps/model/project.ex +++ b/lib/code_corps/model/project.ex @@ -31,6 +31,9 @@ defmodule CodeCorps.Project do field :title, :string field :total_monthly_donated, :integer, default: 0 field :website, :string + field :open_conversations_count, :integer + field :closed_conversations_count, :integer + belongs_to :organization, CodeCorps.Organization diff --git a/priv/repo/migrations/20171226203914_add_counter_cache_to_project.exs b/priv/repo/migrations/20171226203914_add_counter_cache_to_project.exs new file mode 100644 index 000000000..c57a4349d --- /dev/null +++ b/priv/repo/migrations/20171226203914_add_counter_cache_to_project.exs @@ -0,0 +1,10 @@ +defmodule CodeCorps.Repo.Migrations.AddCounterCacheToProject do + use Ecto.Migration + + def change do + alter table(:projects) do + add :open_conversations_count, :integer + add :closed_conversations_count, :integer + end + end +end