Sha256: e102d4ee4836bf4bab1fd387a3888c8fc57d7d7dd011676c38e3701c87a90cd7

Contents?: true

Size: 492 Bytes

Versions: 3

Compression:

Stored size: 492 Bytes

Contents

class AddNestedSetsToPandaCMSPages < ActiveRecord::Migration[7.1]
  def self.up
    Panda::CMS::Page.where(parent_id: 0).update_all(parent_id: nil)
    add_column :panda_cms_pages, :lft, :integer
    add_column :panda_cms_pages, :rgt, :integer

    # This is necessary to update :lft and :rgt columns
    Panda::CMS::Page.reset_column_information
    Panda::CMS::Page.rebuild!
  end

  def self.down
    remove_column :panda_cms_pages, :lft
    remove_column :panda_cms_pages, :rgt
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
panda-cms-0.7.3 db/migrate/20240315125421_add_nested_sets_to_panda_cms_pages.rb
panda-cms-0.7.2 db/migrate/20240315125421_add_nested_sets_to_panda_cms_pages.rb
panda-cms-0.7.0 db/migrate/20240315125421_add_nested_sets_to_panda_cms_pages.rb