Sha256: 7c962b8b8847a92e68057a0a8e26e22b7e33afee1690e040069be97ab35ee9f9
Contents?: true
Size: 421 Bytes
Versions: 4
Compression:
Stored size: 421 Bytes
Contents
class EltChildrenCount < ActiveRecord::Migration def self.up add_column :elts, :elts_count, :integer, :default => 0 execute 'UPDATE elts SET elts_count = (SELECT COUNT(*) FROM elts e2 WHERE e2.parent_id = elts.id)' add_index "elts", ["lft"], :name => "elts_lft_key", :unique => true add_index "elts", ["parent_id"], :name => "elts_parent_key" end def self.down remove_column :elts, :elts_count end end
Version data entries
4 entries across 4 versions & 1 rubygems