Skip to content

Instantly share code, notes, and snippets.

@adriand
Created August 20, 2010 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adriand/540755 to your computer and use it in GitHub Desktop.
Save adriand/540755 to your computer and use it in GitHub Desktop.
class AddVideoFields < ActiveRecord::Migration
def self.up
add_column :videos, :thumbnail_file_name, :string
add_column :videos, :thumbnail_content_type, :string
add_column :videos, :thumbnail_file_size, :integer
add_column :videos, :thumbnail_updated_at, :datetime
add_column :videos, :video_file_name, :string
add_column :videos, :video_content_type, :string
add_column :videos, :video_file_size, :integer
add_column :videos, :video_updated_at, :datetime
add_column :videos, :job_id, :string
add_column :videos, :encoded_state, :string, :default => "unencoded"
add_column :videos, :output_url, :string
add_column :videos, :duration_in_ms, :integer
# due to issues with Flash players, it is sometimes useful to manually set aspect ratio:
add_column :videos, :aspect_ratio, :string
end
def self.down
remove_column :videos, :aspect_ratio
remove_column :videos, :duration_in_ms
remove_column :videos, :output_url
remove_column :videos, :encoded_state
remove_column :videos, :job_id
remove_column :videos, :thumbnail_file_name
remove_column :videos, :thumbnail_content_type
remove_column :videos, :thumbnail_file_size
remove_column :videos, :thumbnail_updated_at
remove_column :videos, :video_file_name
remove_column :videos, :video_content_type
remove_column :videos, :video_file_size
remove_column :videos, :video_updated_at
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment