Skip to content
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

Comments by multi-byte characters are ignored #836

Open
a-suenami opened this issue Sep 12, 2020 · 4 comments · May be fixed by #986
Open

Comments by multi-byte characters are ignored #836

a-suenami opened this issue Sep 12, 2020 · 4 comments · May be fixed by #986

Comments

@a-suenami
Copy link

a-suenami commented Sep 12, 2020

Hi, everyone. So thank you for great product.

I occurred in trouble and want to hear everyone's opinion.

I'm Japanese developer so often add some comment for each database column in Japanese.

For example:

create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci", comment: "ユーザ", force: :cascade do |t|
  t.string "name", null: false, comment: "名前"
  t.string "email", null: false, comment: "メールアドレス"
end

However, they're ignored because they don't match a regular expression which checks diff between old schema and new schema, It's specified here.

If we don't have any problems, I want to fix the problem as follows.

# current
column_pattern = /^#[\t ]+[\w\*\.`]+[\t ]+.+$/

# I expect
column_pattern = /^#[\t ]+[^\t ]+[\t ]+.+$/

What do you think?

Commands

$ bundle exec annotate
Model files unchanged.

Version

  • annotate version
    • 3.1.1
  • rails version
    • 6.0.3.2
  • ruby version
    • 2.7.1
@younthu
Copy link

younthu commented Oct 22, 2020

Same here

1 similar comment
@igaiga
Copy link

igaiga commented Mar 24, 2021

Same here

y-yagi added a commit to y-yagi/annotate_models that referenced this issue May 16, 2023
y-yagi added a commit to y-yagi/annotate_models that referenced this issue May 16, 2023
y-yagi added a commit to y-yagi/annotate_models that referenced this issue May 16, 2023
y-yagi added a commit to y-yagi/annotate_models that referenced this issue Jul 4, 2023
@tkfric
Copy link

tkfric commented Jul 10, 2023

Same here

@jmatsu
Copy link

jmatsu commented Apr 1, 2024

This still happens on HEAD of develop branch (i.e. 5d01c41), so we've switched to with_comment_column style instead of with_comment. It works great even if a comment includes any cause character like multi-byte characters. I hope this will help you.

y-yagi added a commit to y-yagi/annotate_models that referenced this issue Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants