require 'migration_helpers'
class CreateReferenceLogs < ActiveRecord::Migration
  def self.up
    create_table :reference_logs do |t|
      t.integer :channel_id
      t.integer :tape_id
      t.integer :start_at
      t.integer :end_at

      t.timestamps
    end
		add_index :reference_logs, [:channel_id, :tape_id]
		foreign_key :reference_logs, :channel_id, :delete => "cascade"
		foreign_key :reference_logs, :tape_id, :delete => "cascade"
  end

  def self.down
		drop_foreign_key :reference_logs, :channel_id
		drop_foreign_key :reference_logs, :tape_id
    drop_table :reference_logs
  end
end

{'avg_line_length': 26.17391304347826, 'max_line_length': 64, 'alphanum_fraction': 0.7275747508305648, 'licenses': ['Apache-2.0'], 'repository_name': 'Aketzu/Elaine', 'path': 'db/migrate/20080616190700_create_reference_logs.rb', 'size': 602, 'lang': 'Ruby'}