Rails: How to add add_index to existing table

前端 未结 3 1976
礼貌的吻别
礼貌的吻别 2021-02-04 06:55

I already migrated a table called units with several columns. I was wondering how to migrate in a stand alone \'add_index\' to this table using the cmd. Is this code correct:

3条回答
  •  旧时难觅i
    2021-02-04 07:32

    The self.up method is correct. Use this for your self.down:

    remove_index :units, :column => :lesson_id
    

提交回复
热议问题