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.integer :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 :div_id 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.string :link t.integer :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_text_boxes do |t| t.integer :page_block_id, index: true t.text :content t.integer :order t.string :css_class t.timestamps null: false end add_foreign_key :pages_cms_text_boxes, :pages_cms_page_blocks, column: :page_block_id create_table :pages_cms_image_boxes do |t| t.integer :page_block_id, index: true t.integer :image_id, index: true t.string :heading t.text :content t.integer :order t.timestamps null: false end add_foreign_key :pages_cms_image_boxes, :pages_cms_page_blocks, column: :page_block_id add_foreign_key :pages_cms_image_boxes, :pages_cms_images, column: :image_id create_table :pages_cms_blog_feeds do |t| t.integer :page_block_id, index: true t.integer :limit t.timestamps null: false end add_foreign_key :pages_cms_blog_feeds, :pages_cms_page_blocks, column: :page_block_id create_table :pages_cms_sidebars do |t| t.integer :page_id, index: true t.integer :use_instead t.text :content t.text :links t.boolean :show, default: true t.boolean :fb_feed, default: false t.boolean :tw_feed, default: false t.timestamps null: false end add_foreign_key :pages_cms_sidebars, :pages_cms_pages, column: :page_id create_table :pages_cms_sliders do |t| t.integer :page_id, index: true t.integer :image_id, index: true t.string :header t.string :link t.integer :order t.boolean :show t.timestamps null: false end add_foreign_key :pages_cms_sliders, :pages_cms_pages, column: :page_id add_foreign_key :pages_cms_sliders, :pages_cms_images, column: :image_id create_table :pages_cms_articles do |t| t.integer :image_id, index: true t.text :content 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