This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |