class CreateInitialDb < ActiveRecord::Migration def change create_table :pages_cms_accounts do |t| t.string :name t.string :site_name t.string :email t.timestamps null: false end 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 :link 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_contact_fields do |t| t.integer :page_block_id, index: true t.text :content t.timestamps null: false end add_foreign_key :pages_cms_contact_fields, :pages_cms_page_blocks, column: :page_block_id create_table :pages_cms_contacts do |t| t.string :name t.string :email t.text :message t.timestamps null: false end create_table :pages_cms_sidebars do |t| t.integer :page_id, index: true t.integer :use_instead t.text :content t.boolean :show, default: true t.boolean :fb_feed, default: false t.boolean :tw_feed, default: false t.boolean :all_tags, default: false t.boolean :all_posts, default: false t.boolean :all_pages, default: false t.boolean :blog_search, default: false t.text :links 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, default: false t.boolean :archived, default: false 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