How to remove a column from my Rails model?

前端 未结 3 570
温柔的废话
温柔的废话 2021-01-30 16:27

I need to remove a few columns from my rails model which i already created and have some row entries in that model. How to do it? Any links which has details for modifying the s

3条回答
  •  遥遥无期
    2021-01-30 17:01

    Via command alternative as Add, only change Add to Remove:

    Single Column:

    rails g migration RemoveColumnFromTable column:type
    

    Multiple Columns:

    rails g migration RemoveColumn1AndColumn2FromTable column1:type colummn2:type
    

提交回复
热议问题