Sha256: cafcdf9931ed533793b1808a64938f960c328a732afe7bd47ffe81750fa6c5a6

Contents?: true

Size: 1.13 KB

Versions: 27

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, dependent: :delete)
    add_foreign_key(:menus_pages, :pages, dependent: :delete)
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
ack_rocket_cms-0.9.2 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.9.2 lib/generators/rocket_cms/templates/migration_pages.rb
ack_rocket_cms-0.9.1.3 lib/generators/rocket_cms/templates/migration_pages.rb
ack_rocket_cms-0.9.1.2 lib/generators/rocket_cms/templates/migration_pages.rb
ack_rocket_cms-0.9.1.1 lib/generators/rocket_cms/templates/migration_pages.rb
ack_rocket_cms-0.9.1 lib/generators/rocket_cms/templates/migration_pages.rb
ack_rocket_cms-0.9 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.9.1 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.8.13 lib/generators/rocket_cms/templates/migration_pages.rb
ack_rocket_cms-0.8.2 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.8.12 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.8.11 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.8.10 lib/generators/rocket_cms/templates/migration_pages.rb
ack_rocket_cms-0.8.0 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.8.9 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.8.8 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.8.7 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.8.6 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.8.5 lib/generators/rocket_cms/templates/migration_pages.rb
rocket_cms-0.8.4 lib/generators/rocket_cms/templates/migration_pages.rb