# File lib/archivist/base/db.rb, line 20 def archive_table_exists? connection.table_exists?("archived_#{table_name}") end
# File lib/archivist/base/db.rb, line 38 def create_archive_indexes # TODO? end
# File lib/archivist/base/db.rb, line 24 def create_archive_table if table_exists? && !archive_table_exists? cols = self.columns.reject { |column| column.name == primary_key } connection.create_table("archived_#{table_name}") cols.each do |c| connection.add_column("archived_#{table_name}",c.name,c.type) end connection.add_column("archived_#{table_name}",:deleted_at,:datetime) if archive_options[:associate_with_original] connection.add_column("archived_#{table_name}","#{self.new.class.to_s.underscore}_id",:integer) end end end
Generated with the Darkfish Rdoc Generator 2.