Sha256: c16c4c64c7c7b4cc8592f9ac57138c4c3530da89dc88490967d40ada101b0838

Contents?: true

Size: 1.13 KB

Versions: 39

Compression:

Stored size: 1.13 KB

Contents

class RocketCmsCreatePages < ActiveRecord::Migration
  def change
    create_table :menus do |t|

      if RocketCMS.config.localize
        t.column :name_translations, 'hstore'
      else
        t.string :name, null: false
      end
      t.string :slug, null: false
      t.timestamps
    end
    add_index :menus, :slug, unique: true

    create_table :pages do |t|
      t.boolean :enabled, default: true, null: false
      t.integer :parent_id
      t.integer :lft
      t.integer :rgt
      t.integer :depth 

      if RocketCMS.config.localize
        t.column :name_translations, 'hstore', default: {}
        t.column :content_translations, 'hstore', default: {}
      else
        t.string :name, null: false
        t.text :content
      end

      t.string :slug, null: false
      t.string :regexp
      t.string :redirect
      t.string :fullpath, null: false
      t.timestamps
    end
    add_index :pages, :slug, unique: true
    add_index :pages, [:enabled, :lft]

    create_join_table :menus, :pages

    add_foreign_key(:menus_pages, :menus, on_delete: :cascade)
    add_foreign_key(:menus_pages, :pages, on_delete: :cascade)
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
rocket_cms-0.17.2 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.17.1 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.17.0 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.16.1 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.16.0 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.15.5 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.15.4 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.15.3 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.15.2 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.15.1 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.15.0 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.14.0 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.13.6 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.13.5 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.13.4 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.13.3 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.13.2 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.13.1 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.13.0 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.12.3 lib/generators/rocket_cms/templates/migration_pages.rb