class CreateProjects < ActiveRecord::Migration
  def self.up
    create_table :projects do |t|
      t.column :user_id,         :integer,  :null => false
      t.column :exercise_id,     :integer
      t.column :title,           :string
      t.column :description,     :text
      t.column :url,             :string
      t.column :duration,        :integer
      t.column :is_visible,      :boolean,  :default => true
      t.column :is_featured,     :boolean,  :default => false
      t.column :upload_hash,     :string,   :limit => 40
      
      t.column :created_at,      :datetime
      t.column :updated_at,      :datetime      
    end
    
    add_index :projects, :user_id
    add_index :projects, :exercise_id
  end

  def self.down
    drop_table :projects
  end
end
