Creating database tables

Hi all,

What I’m facing is this: We have a git repository to handle updates to our production SuiteCRM instance. We have a test instance running on master branch to test all changes and, if all works as expected, only after testing merge it to production branch used by, you guessed it, the production instance. Now the difficulty is that when an update or customization (say, a new custom module) requires new database tables or fields to be made, these are obviously not copied over through git. However QR&R doesn’t seem to create the missing ones reliably, and we’re left with needing to manually duplicate the new table structure(s) and/or changes to existing structure. Once that is done, all works as it should. Obviously I’d much prefer this to be automated.

Is there a way to make SuiteCRM check and create as needed all database tables and fields described in vardefs?

If fields and relationships are created via Code (not studio) then those files when deployed to master or production will give you a Query to execute after Repair/Rebuild and thus no need for Copying over tables.

@cherub-chum thanks. For some reason there are no queries shown. I also expected those, so I’m puzzled. It’s like SuiteCRM being completely oblivious to the missing fields - they are shown in views (albeit you can’t edit them) and I don’t get any visible errors. I don’t quite understand what’s happening. Maybe it’s because at least some of the fields were made in studio?

I don’t know if this is the problem, but just in case - ensure that you’re not moving the automatically generated directories and files from one system to another through git.

Exclude everything that has /Ext/ in it, except stuff that is in custom/Extension/**/Ext/

Another tip for your investigations is a database table called fields_meta_data, normally you don’t have to operate that table manually, but keeping an eye on it sometimes helps you understand what’s going on.

As an update, @pgr was right; apparently some Ext directories were still synced. After a short testing (added a new module) it seems to work as expected.

Except for one thing. I noticed that the when the modules are merged to production this way, for some reason they don’t show up in Module Loader on the production server and remain visible only in the testing server. Since they are seen in testing server running on master branch this isn’t really big of an issue, but I’m curious, what could be the cause of this? Some file ignored by git or missing database entries?

They are in upload/upgrades/module if I’m not mistaken. Those are the source packages, they are not required if the module is already installed. But I believe that is where Module Loader loads its list from.

Gaah, my .gitignore just keeps expanding… :wink: