-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Model Annotation Not Updated When Modifying Table Columns Using change_table. #169
Comments
DetailI understood what was happening. I knew why. It doesn't seem to work when the table information contains anything other than English and numbers. Post.rb# == Schema Information
#
# Table name: posts
#
# id :uuid not null, primary key
# title(タイトル) :string not null
# content(内容) :text not null
# created_at :datetime not null
# updated_at :datetime not null
#
class Post < ApplicationRecord
end And, I generate migration file. class AddMemoToPost < ActiveRecord::Migration[7.2]
def change
add_column :posts, :memo, :text, comment: "メモ"
end
end I do ❯ ber db:migrate
== 20241201063248 AddMemoToPost: migrating ====================================
-- add_column(:posts, :memo, :text, {:comment=>"メモ"})
-> 0.0159s
== 20241201063248 AddMemoToPost: migrated (0.0161s) ===========================
Annotating models
Model files unchanged. -> But, If I don't use Japanese, I use English comment. class AddMemoToPost < ActiveRecord::Migration[7.2]
def change
- add_column :posts, :memo, :text, comment: "メモ"
+ add_column :posts, :memo, :text, comment: "memo"
end
end And I do migrate! ❯ ber db:migrate
== 20241201063248 AddMemoToPost: migrating ====================================
-- add_column(:posts, :memo, :text, {:comment=>"memo"})
-> 0.0039s
== 20241201063248 AddMemoToPost: migrated (0.0039s) ===========================
Annotating models
Annotated (3): app/models/post.rb, spec/models/post_spec.rb, spec/factories/posts.rb -> Annotated!! # == Schema Information
#
# Table name: posts
#
# id :uuid not null, primary key
# title(タイトル) :string not null
# content(内容) :text not null
# created_at :datetime not null
# updated_at :datetime not null
# memo(memo) :text
#
class Post < ApplicationRecord
end Reason Code
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe your problem here.
Commands
^ I wrote the above migration file and migrated it.
bundle exec rails db:migrate
^ 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
The text was updated successfully, but these errors were encountered: