Why is dangerous add columns to core tables?

Re: Why is dangerous add columns to core tables?

by nivedita setru -
Number of replies: 0

I have developed number of modules,blocks,plugins for moodle/totara. There are some rules we follow to make code scalable and easy to maintain.

One of those rules is to never touch core tables. I have done some mistakes before when I was new to moodle coding and I directly edited core code or added fields to core tables. Have had issues while upgrading or testers found issues during System test/UAT and many times after we go live. It becomes difficult to fix and also while upgrading to later versions it could take lot of your time to make sure this change is not affecting anywhere else.

I suggest if you need to make any hacks to core functionality it is easier to create a plugin within /local/, For eg-/local/<pluginname>_extension. Within the folder create a /db/ folder which can have install.xml (which is generated via xmldb-editor if you need to add some tables), upgrade.php etc scripts. You could also write some code for various customization related to core module within this local plugin. So, this would mean minimal core hacks, and doesn't involve any risk. 


Average of ratings: Useful (1)