Commit b70ffbc9 by Alexey Mahotkin Committed by Daniel Schierbeck

Shorten migration roll-back also

parent 500f1bb1
...@@ -23,6 +23,7 @@ module Paperclip ...@@ -23,6 +23,7 @@ module Paperclip
Paperclip.options[:logger] = defined?(ActiveRecord) ? ActiveRecord::Base.logger : Rails.logger Paperclip.options[:logger] = defined?(ActiveRecord) ? ActiveRecord::Base.logger : Rails.logger
ActiveRecord::ConnectionAdapters::AbstractAdapter.send(:include, Paperclip::Schema)
ActiveRecord::ConnectionAdapters::Table.send(:include, Paperclip::Schema) ActiveRecord::ConnectionAdapters::Table.send(:include, Paperclip::Schema)
ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, Paperclip::Schema) ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, Paperclip::Schema)
end end
......
...@@ -6,5 +6,12 @@ module Paperclip ...@@ -6,5 +6,12 @@ module Paperclip
column :"#{name}_file_size", :integer column :"#{name}_file_size", :integer
column :"#{name}_updated_at", :datetime column :"#{name}_updated_at", :datetime
end end
def drop_attached_file(table_name, name)
remove_column table_name, :"#{name}_file_name"
remove_column table_name, :"#{name}_content_type"
remove_column table_name, :"#{name}_file_size"
remove_column table_name, :"#{name}_updated_at"
end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment