Sha256: fd2dbc56438b3044910f274b384078e0684f26bae13d0e8f74cf54128850ff4f

Contents?: true

Size: 889 Bytes

Versions: 3

Compression:

Stored size: 889 Bytes

Contents

class AddNestedToPandaCMSMenuItems < ActiveRecord::Migration[7.1]
  def change
    add_column :panda_cms_menu_items, :parent_id, :uuid
    add_column :panda_cms_menu_items, :lft, :integer
    add_column :panda_cms_menu_items, :rgt, :integer
    add_column :panda_cms_menu_items, :depth, :integer
    add_column :panda_cms_menu_items, :children_count, :integer, null: false, default: 0

    add_index :panda_cms_menu_items, :lft
    add_index :panda_cms_menu_items, :rgt

    Panda::CMS::MenuItem.reset_column_information
    Panda::CMS::MenuItem.rebuild!

    # Update pages whilst we're at it
    add_column :panda_cms_pages, :depth, :integer
    add_column :panda_cms_pages, :children_count, :integer, null: false, default: 0
    add_index :panda_cms_pages, :lft
    add_index :panda_cms_pages, :rgt

    Panda::CMS::Page.reset_column_information
    Panda::CMS::Page.rebuild!
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
panda-cms-0.7.3 db/migrate/20240316230706_add_nested_to_panda_cms_menu_items.rb
panda-cms-0.7.2 db/migrate/20240316230706_add_nested_to_panda_cms_menu_items.rb
panda-cms-0.7.0 db/migrate/20240316230706_add_nested_to_panda_cms_menu_items.rb