This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
binaryattraction/schema/migrations/007_photo_flag_migration.rb

17 lines
423 B
Ruby

class PhotoFlagMigration < ActiveRecord::Migration
def self.up
create_table :photo_flags do |t|
t.integer :user_id, :photo_id
t.string :session_id
end
add_index :photo_flags, :user_id
add_index :photo_flags, :photo_id
add_column :photos, :photo_flags_count, :integer, :default => 0
end
def self.down
drop_table :photo_flags
remove_column :photos, :photo_flags_count
end
end