Class: CreateIndexTankedDocuments
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreateIndexTankedDocuments
- Defined in:
- lib/generators/index_tanked/templates/migration.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/generators/index_tanked/templates/migration.rb', line 19 def self.down remove_index :index_tanked_documents, :locked_at remove_index :index_tanked_documents, :locked_by remove_index :index_tanked_documents, [:model_name, :record_id] remove_index :index_tanked_documents, :name => 'index_index_tanked_documents_docid_by_identifier' drop_table :index_tanked_documents end |
.up ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/generators/index_tanked/templates/migration.rb', line 2 def self.up create_table :index_tanked_documents, :force => true do |t| t.integer :record_id # id of the record being indexed t.string :model_name # Activerecord Model name t.text :document # document from #document_for_batch_addition t.datetime :locked_at # Set when a client is working on this object t.string :locked_by # Who is working on this object (if locked) t. end add_index :index_tanked_documents, :locked_at add_index :index_tanked_documents, :locked_by add_index :index_tanked_documents, [:model_name, :record_id] add_index :index_tanked_documents, [:model_name, :record_id, :locked_by], :name => 'index_index_tanked_documents_docid_by_identifier' end |