module ActsAsArchivable::Schema

Public Instance Methods

archived_table_schema() click to toggle source
# File lib/acts_as_archivable/schema.rb, line 11
def archived_table_schema
  table_schema
    .gsub(/#{table_name}/, archived_table_name)
    .gsub(/(create_table|add_index)/, 'ActiveRecord::Migration.\1')
end
table_schema() click to toggle source
# File lib/acts_as_archivable/schema.rb, line 3
def table_schema
  schema = ActiveRecord::SchemaDumper
           .send(:new, ActiveRecord::Base.connection)
           .send(:table, table_name, Tempfile.new('temporary_schema'))
  schema.rewind
  schema.read
end