Sha256: 1aa4c58583e5d797775ddaa2b9d57c8793fec9e3e3cb387ace62bcbd9c7c1d8a

Contents?: true

Size: 1.19 KB

Versions: 130

Compression:

Stored size: 1.19 KB

Contents

class CreatePages < ActiveRecord::Migration
  def migrate(direction)
    super
    if direction == :up
      # Reset the column info
      ApplicationPage.reset_column_information
    end
  end

  def change
    create_table :pages do |t|
      t.integer :parent_id
      t.integer :position
      t.string  :type
      t.string  :static_uuid

      t.timestamps
    end

    create_table :page_hierarchies, :id => false do |t|
      t.integer  :ancestor_id, :null => false   # ID of the parent/grandparent/great-grandparent/... tag
      t.integer  :descendant_id, :null => false # ID of the target tag
      t.integer  :generations, :null => false   # Number of generations between the ancestor and the descendant. Parent/child = 1, for example.
    end

    create_table :page_translations do |t|
      t.references :page
      t.string     :locale

      t.string :title
      t.string :path_component
      t.text   :body
    end

    add_index :page_hierarchies,  [:ancestor_id, :descendant_id], :unique => true
    add_index :page_hierarchies,  [:descendant_id]
    add_index :page_translations, [:page_id]
    add_index :page_translations, [:locale]
    add_index :page_translations, [:path_component]
  end
end

Version data entries

130 entries across 130 versions & 1 rubygems

Version Path
lalala-4.1.0.dev.425 db/migrate/20130321140353_create_pages.rb
lalala-4.1.0.dev.420 db/migrate/20130321140353_create_pages.rb
lalala-4.1.0.dev.419 db/migrate/20130321140353_create_pages.rb
lalala-4.1.0.dev.418 db/migrate/20130321140353_create_pages.rb
lalala-4.1.0.dev.417 db/migrate/20130321140353_create_pages.rb
lalala-4.0.0.dev.416 db/migrate/20130321140353_create_pages.rb
lalala-4.1.0.dev.415 db/migrate/20130321140353_create_pages.rb
lalala-4.1.0.dev.414 db/migrate/20130321140353_create_pages.rb
lalala-4.1.0.dev.413 db/migrate/20130321140353_create_pages.rb
lalala-4.1.0.dev.412 db/migrate/20130321140353_create_pages.rb
lalala-4.1.0.dev.411 db/migrate/20130321140353_create_pages.rb
lalala-4.1.0.dev.410 db/migrate/20130321140353_create_pages.rb
lalala-4.1.0.dev.409 db/migrate/20130321140353_create_pages.rb
lalala-4.0.0.dev.407 db/migrate/20130321140353_create_pages.rb
lalala-4.1.0.dev.408 db/migrate/20130321140353_create_pages.rb
lalala-4.1.0.dev.398 db/migrate/20130321140353_create_pages.rb
lalala-4.1.0.dev.397 db/migrate/20130321140353_create_pages.rb
lalala-4.0.0.dev.396 db/migrate/20130321140353_create_pages.rb
lalala-4.0.0.dev.395 db/migrate/20130321140353_create_pages.rb
lalala-4.1.0.dev.394 db/migrate/20130321140353_create_pages.rb