Skip to content

Model Annotation Not Updated When Modifying Table Columns Using change_table. #169

@hatsu38

Description

@hatsu38

Describe your problem here.

Commands

class RemoveOtherColumnsFromQuestionAnswers < ActiveRecord::Migration[7.2]
  def up
    change_table :question_answers, bulk: true do |t|
      t.remove :use_scene
      t.remove :important_point
      t.remove :remark
      t.remove :link
    end
  end

  def down
    change_table :question_answers, bulk: true do |t|
      t.text :use_scene, default: "", null: false, comment: "利用シーン"
      t.text :important_point, default: "", null: false, comment: "重要ポイント"
      t.text :remark, default: "", null: false, comment: "備考"
      t.string :link, default: "", null: false, comment: "リンク"
    end
  end
end

^ I wrote the above migration file and migrated it. bundle exec rails db:migrate

❯ ber db:migrate 
== 20241128110218 RemoveOtherColumnsFromQuestionAnswers: migrating ============
-- change_table(:question_answers, {:bulk=>true})
   -> 0.0046s
== 20241128110218 RemoveOtherColumnsFromQuestionAnswers: migrated (0.0046s) ===

Annotating models
Model files unchanged.

^ Normally, it should result in a model change, but it displayed Model files unchanged. instead. This sometimes happens when modifying a table, but it doesn't occur when creating a table.

Version

  • annotaterb version: 4.13.0
  • rails version: 7.2.2
  • ruby version: 3.3.6
  • database version: postgresql 14
  • database adapter version (if available)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions