class CreateAnnotations < ActiveRecord::Migration[6.1] def change create_table :annotations do |t| t.references :doctrine, null: false t.references :document, null: false, polymorphic: true t.references :annomark, null: false t.string :phil_rep, null: false, default: "" t.text :editor_notes, null: false, default: "" t.integer :rank, null: false, default: 1 t.timestamps end add_index :annotations, %i[doctrine_id annomark_id document_id document_type phil_rep], name: "index_annotation_uniqueness", unique: true end end