Support "rename field" in automatic migration generator

オープン
#209 コメント 2 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Soroushsrd がすでに取り組んでいます。

2025年4月15日 から。

評価

この issue はまだ評価されていません。

説明

enhancement

We should support renaming fields in the automatic migration generator.

This is more complicated than most of the other operations. This is because we can't reliably detect renaming fields (we only see that a field has been removed and then created). For starters, we could detect if a field was renamed by keeping all of its properties intact. Then, we could add some heuristics (like for instance, we see that a field was removed but then recreated with most of its original properties). This, however, needs to be interactive—we need to ask the developer if they actually renamed the field (and then create either a rename, or delete+create operations depending on their reply).

The entry point is probably somewhere in the make_alter_model_operations function: https://github.com/cot-rs/cot/blob/2bbb09699bf7b74c41bb323338a02c528de1acff/cot-cli/src/migration_generator.rs#L329

This will require adding a new OperationInner variant: https://github.com/cot-rs/cot/blob/2bbb09699bf7b74c41bb323338a02c528de1acff/cot/src/db/migrations.rs#L460

Note that the "rename field" operation will need to store the old name of the field, so that an implementation of Operation::backwards can be created.

主要言語
Rust
スター
1.1k
フォーク
57
平均マージ
17時間 39分
マージ済み PR(30日)
12

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

cot-rs/cot のほかの issue

cot-rs/cot の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。