Skip to content

Commit

Permalink
add counter cache
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Dec 26, 2017
1 parent 65ec89b commit ba5d6b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/code_corps/model/project.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ba5d6b3

Please sign in to comment.