4

今日、移行中に部分的な postgres インデックスをテーブルに追加したいという状況がありました。当然のことながら、この種のものは、使用するレールではまだ不可能ですadd_index(いつか来る予定です)

executeそのため、移行ではステートメントを使用する必要があります。

さて、schema.rbこのコメントが一番上にあります:

# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#

残念ながら、カスタム DML がある場合、このステートメントはほとんど役に立たないため、このexecuteステートメントは追跡されません。schema.rbschema.rb

executeDML を含むステートメントを強制的にschema.rb.

4

1 に答える 1