Bulk Insert Fields into cms_accounts table

5 posts by 3 authors in: Forums > CMS Builder
Last Post: March 7, 2019   (RSS)

By dm - March 6, 2019

Hi,

I have a very large list of extra textfields I would like to add to the cms_accounts table.

Can you advise on the best way of going about this with v3.50.

Many thanks for the help!

dm

By dm - March 7, 2019 - edited: March 7, 2019

Ok, so I installed the developer console plugin and found I can easily add additional fields using this code in the MYSQL Console:

ALTER TABLE `cmsb_accounts`
ADD COLUMN stage_1 MEDIUMTEXT,
ADD COLUMN stage_2 MEDIUMTEXT,
ADD COLUMN stage_3 MEDIUMTEXT,
ADD COLUMN stage_4 MEDIUMTEXT;

However I would also like to be able to specify the content for "Field Label" and "Field Type" for these new columns too... (field labels would be same as field names and all field types would be "textfield")

If someone can give me a few pointers on how to do this it would be much appreciated as my mysql skills are quite limited.

By dm - March 7, 2019

Hi Steve, thanks very much for suggestion!

I will investigate the schema files. :)

By daniel - March 7, 2019

Hi dm,

As Steve mentioned, the two ways to add things like Field Label and Field Type to a field are either by modifying the schema file or through the Section Editor. If you attempt to edit the schema, a few additional notes:

  • They can be found in /cmsb/data/schema/ and will be named after the section
  • A simple method to make sure you have all the right options is to first create a field through the Section Editor which meets your needs, then find that definition in the schema file and duplicate it.
  • If the order of the fields is important, make sure to update the 'order' value; fields are sorted by this value in ascending order (smallest to biggest). 
  • After manually modifying a schema file, you must visit the main Section Editors page (http://example.com/cmsb/admin.php?menu=database) to trigger the database to sync the changes

Let me know if you have any further questions!

Thanks,

Daniel
Technical Lead
interactivetools.com