class CreateVideoFileLangs < ActiveRecord::Migration
  def change
    create_table :video_file_langs do |t|
      t.string :title
      t.text :description
      t.string :slug
      t.references :video_file, index: true
      t.integer :lang_site_id

      t.timestamps null: false
      
      
      
      
    end
    add_foreign_key :video_file_langs, :video_files
    
    VideoFile.all.each do |vf|
      
      vf.video_file_langs <<  VideoFileLang.new(:title => vf.title, :description => vf.description, :slug => vf.slug, :lang_site_id => 1)
      vf.video_file_langs <<  VideoFileLang.new(:title => vf.title, :slug => vf.slug, :lang_site_id => 2)
      vf.save
    end
    
  end
end
