Skip to content

Commit ba5d6b3

Browse files
committed
add counter cache
1 parent 65ec89b commit ba5d6b3

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/code_corps/model/project.ex

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ defmodule CodeCorps.Project do
3131
field :title, :string
3232
field :total_monthly_donated, :integer, default: 0
3333
field :website, :string
34+
field :open_conversations_count, :integer
35+
field :closed_conversations_count, :integer
36+
3437

3538
belongs_to :organization, CodeCorps.Organization
3639

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
defmodule CodeCorps.Repo.Migrations.AddCounterCacheToProject do
2+
use Ecto.Migration
3+
4+
def change do
5+
alter table(:projects) do
6+
add :open_conversations_count, :integer
7+
add :closed_conversations_count, :integer
8+
end
9+
end
10+
end

0 commit comments

Comments
 (0)