class CreateInitialDb < ActiveRecord::Migration def change create_table :pages_cms_pages do |t| t.string :title t.string :slug t.string :meta_tags t.string :meta_description t.boolean :draft t.integer :parent_id, index: true t.string :order t.boolean :navbar_show, default: true t.boolean :sidebar_show, default: true t.timestamps null: false end create_table :pages_cms_images do |t| t.string :name t.string :file t.timestamps null: false end create_table :pages_cms_page_blocks do |t| t.integer :page_id, index: true t.integer :order t.string :name t.string :order t.timestamps null: false end add_foreign_key :pages_cms_page_blocks, :pages_cms_pages, column: :page_id create_table :pages_cms_thumbnails do |t| t.integer :page_block_id, index: true t.integer :image_id, index: true t.text :content t.text :content_rendered t.string :link t.string :order t.timestamps null: false end add_foreign_key :pages_cms_thumbnails, :pages_cms_page_blocks, column: :page_block_id add_foreign_key :pages_cms_thumbnails, :pages_cms_images, column: :image_id create_table :pages_cms_jumbotrons do |t| t.integer :page_block_id, index: true t.text :content t.text :content_rendered t.string :link t.string :order t.timestamps null: false end add_foreign_key :pages_cms_jumbotrons, :pages_cms_page_blocks, column: :page_block_id create_table :pages_cms_text_boxes do |t| t.integer :page_block_id, index: true t.text :content t.text :content_rendered t.string :order t.timestamps null: false end add_foreign_key :pages_cms_text_boxes, :pages_cms_page_blocks, column: :page_block_id create_table :pages_cms_sidebars do |t| t.integer :page_id, index: true t.text :content t.text :content_rendered t.boolean :show, default: true t.integer :use_instead t.timestamps null: false end add_foreign_key :pages_cms_sidebars, :pages_cms_pages, column: :page_id create_table :pages_cms_articles do |t| t.integer :image_id, index: true t.text :content t.text :content_rendered t.string :title t.boolean :draft t.boolean :archived t.text :tags, array: true, default: [] t.timestamps null: false end add_foreign_key :pages_cms_articles, :pages_cms_images, column: :image_id end end