Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am dolan on github.
  • I am ddolan (https://keybase.io/ddolan) on keybase.
  • I have a public key ASAlOUW79qborZe18zFLGsVsEThOWG1RSK7X-a6EWMk3igo

To claim this, I am signing this object:

class CreateItemChildrenCountView < ActiveRecord::Migration
def self.up
execute <<-SQL
CREATE VIEW item_children_count AS
SELECT parent_id AS item_id, COUNT(*) as children_count
FROM items GROUP BY parent_id;
SQL
end
def self.down