6 changed files with 30 additions and 6 deletions
@ -0,0 +1,7 @@ |
|||||||
|
class AnnotationAnnomark < ApplicationRecord |
||||||
|
belongs_to :annotation, optional: false |
||||||
|
|
||||||
|
belongs_to :annomark, optional: false |
||||||
|
|
||||||
|
validates :annomark_id, uniqueness: { scope: %i[annotation_id] } |
||||||
|
end |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
class RemoveAnnomarkIdInAnnotations < ActiveRecord::Migration[6.1] |
||||||
|
def change |
||||||
|
safety_assured { remove_column :annotations, :annomark_id, :integer, null: false } |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
class CreateAnnotationAnnomarks < ActiveRecord::Migration[6.1] |
||||||
|
def change |
||||||
|
create_table :annotation_annomarks do |t| |
||||||
|
t.references :annotation, null: false |
||||||
|
t.references :annomark, null: false |
||||||
|
|
||||||
|
t.timestamps |
||||||
|
end |
||||||
|
|
||||||
|
add_index :annotation_annomarks, %i[annotation_id annomark_id], |
||||||
|
name: "index_annotation_annotation_marks_uniquness", unique: true |
||||||
|
end |
||||||
|
end |
||||||
Loading…
Reference in new issue