Advertisement
matthewpoer

SugarCRM Fields, Changing Field Types

Nov 29th, 2012
646
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 2.25 KB | None | 0 0
  1. /*
  2. I don't share this fact often, but SugarCRM fields can change types if you do it from the database. Assuming there are no vardefs specifying otherwise, here's how I converted a set of dropdown (enum) fields to open-text (varchar) fields...
  3.  
  4. Caution, though! You can lose data if your change data types or shorten a field in a live database. Use your head. There's a reason the SugarCRM Studio doesn't do this for you.
  5. */
  6.  
  7. update fields_meta_data set
  8. ext1=null,
  9. type='varchar',
  10. len = 255,
  11. default_value = ''
  12. where id in(
  13. 'A1_Poolskimmer_manufacturer_c',
  14. 'A1_Poolskimmer_model_number_c',
  15. 'A1_Poolskimmer_basket_size_c',
  16. 'A1_Poolskimmer_door_size_c',
  17. 'A1_Poolnumber_of_inlets_c',
  18. 'A1_Poolautomatic_pool_cleaner_manuf_c',
  19. 'A1_Poolautormatic_pool_cleaner_mode_c',
  20. 'A1_Poolpump_manufacturer_c',
  21. 'A1_Poolpump_model_number_c',
  22. 'A1_Poolfilter_model_number_c',
  23. 'A1_Poolfilter_size_c',
  24. 'A1_Poolheater_manufacturer_c',
  25. 'A1_Poolheater_model_number_c',
  26. 'A1_Poolchlorinator_manufacturer_c',
  27. 'A1_Poolchlorinator_model_number_c',
  28. 'A1_Poolfeeder_manufacturer_c',
  29. 'A1_Poolfeeder_model_number_c'
  30. );
  31.  
  32. alter table a1_pool_cstm modify skimmer_manufacturer_c VARCHAR(255);
  33. alter table a1_pool_cstm modify skimmer_model_number_c VARCHAR(255);
  34. alter table a1_pool_cstm modify skimmer_basket_size_c VARCHAR(255);
  35. alter table a1_pool_cstm modify skimmer_door_size_c VARCHAR(255);
  36. alter table a1_pool_cstm modify number_of_inlets_c VARCHAR(255);
  37. alter table a1_pool_cstm modify automatic_pool_cleaner_manuf_c VARCHAR(255);
  38. alter table a1_pool_cstm modify autormatic_pool_cleaner_mode_c VARCHAR(255);
  39. alter table a1_pool_cstm modify pump_manufacturer_c VARCHAR(255);
  40. alter table a1_pool_cstm modify pump_model_number_c VARCHAR(255);
  41. alter table a1_pool_cstm modify filter_model_number_c VARCHAR(255);
  42. alter table a1_pool_cstm modify filter_size_c VARCHAR(255);
  43. alter table a1_pool_cstm modify heater_manufacturer_c VARCHAR(255);
  44. alter table a1_pool_cstm modify heater_model_number_c VARCHAR(255);
  45. alter table a1_pool_cstm modify chlorinator_manufacturer_c VARCHAR(255);
  46. alter table a1_pool_cstm modify chlorinator_model_number_c VARCHAR(255);
  47. alter table a1_pool_cstm modify feeder_manufacturer_c VARCHAR(255);
  48. alter table a1_pool_cstm modify feeder_model_number_c VARCHAR(255);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement