-
-
Notifications
You must be signed in to change notification settings - Fork 109
migrate_adding_id_to_yaml で created_at も書き出すよう修正
#1772
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
base: main
Are you sure you want to change the base?
Conversation
| new_dojo = {} | ||
| new_dojo['id'] = d.id | ||
| #new_dojo['order'] = d.order # ID の直後に固定させる場合の例 | ||
| new_dojo['order'] = d.order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
今回の title/description を読む限りではココのコメントアウトの解除は不要そうかなと思いましたが、もし何か解除した理由などあれば description に記載いただけると助かります...!! 🙏 ✨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yasulab コメントありがとうございます!
YAML 内の既存の記述に影響を与えない(記載内容の並び順を既存と揃える)ため 、new_dojo['order'] = d.order のコメントアウトを解除しています。
もし、既存の記載内容の並び順が変わってしまっても問題ないようでしたら、2. のようにコメントアウトを解除しない方が、記述もその後の処理もスッキリしそうと感じたのですが、どちらが良さそうでしょうか 👀💭
new_dojo['order'] = d.orderのコメントアウトを解除する- YAMLの記載は既存の並び順の通り
- id
- order
- created_at
- ...
- YAMLの記載は既存の並び順の通り
new_dojo['order'] = d.orderのコメントアウトを解除しない- YAMLの記載順は以下になる
- id
- created_at
- order
- ...
- 既存の記述も記載順が入れ替わる(内容は変わらない
- YAMLの記載順は以下になる
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rakuda-san-desu なるほどです! 理由がどこにも記載されておらずコメント解除のみ行われていた点 が気になった部分ですので、であればその理由を description に記載していただけると助かります! (>人< )✨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description に追記しました!
今後も理由まで記載するようにしていきます📝
ご確認ありがとうございます🙏✨
|
タスクを実行すると、 🔽 出力結果 - id: 349
order: '011002'
created_at: '2025-12-16'
name: サンプル
prefecture_id: 1
logo: "/img/dojos/default.webp"
url: https://example.com/
description: 札幌市で月2回開催
tags:
- Scratch
- micro:bit
- Arduino
- ラズベリーパイ
- 電子工作 |
|
@nacchan99 動作確認ありがとうございます🙏✨ |
close: #1770
やったこと
migrate_adding_id_to_yamlを実行したとき、idと一緒にcreated_atも書き出すよう修正しました🛠️メモ:
YAML 内の既存の記述に影響を与えない(記載内容の並び順を既存と揃える)ため 、
new_dojo['order'] = d.orderのコメントアウトを解除しています!確認したこと
idとcreated_atが書き出される確認方法
db/dojos.ymlに以下のサンプルを入力$ bundle exec rails dojos:update_db_by_yamlを実行$ bundle exec rails dojos:migrate_adding_id_to_yamlを実行idとcreated_atが書き出されるMEMO: 確認後、サンプルで作成されたデータは削除しておく