Manage database column


 I have a database table [color="#FF0000"]tbl_goods[/color] with [b]4 column, (ID,name,image,path)[/b], and I generate Model and CRUD by Gii. I also modify most of auto-generated Model and CRUD files.

However, Column image must be deleted from the database. 
  1. If I delete this column from DB by SQL tools, there would be errors in Yii Model and CRUD tools.

  2. There are many codes I modified. If I generate the code by new DB, a lot of repeat work must be done.

My question is How to manage DB column by Yii itself . How to delete a column safely from DB to keep other changes.

If you delete the column from the database… you need to check all your code manually and remove the instructions where you used that column…

You could delete it from the database using migrations and add some get/set methods that will be “magically” called to catch where you’re using it. You could then use these so:


[*]The API remains the same.

[*]You can log the backtraces of where they’re called.


Obviously this may not catch every case and you still need to find and modify all your code in preparation for removal post deprecation.