CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Alter Organization name varchar size
Pages: [1]

Author Topic: Alter Organization name varchar size  (Read 638 times)

kennedy

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 5
  • CiviCRM version: 4.5.5
  • CMS version: Drupal
  • PHP version: 5.3.10
Alter Organization name varchar size
April 05, 2013, 12:49:34 pm
Can I increase the varchar size of the organization name without affecting the current data in the database?
I will like increase the size of my organization name varchar (alter table civicrm_contact modify organization_name varchar(255)).
Please, advise.
« Last Edit: April 10, 2013, 06:36:26 am by kennedy »

KilakwaBT

  • I post occasionally
  • **
  • Posts: 101
  • Karma: 11
  • CiviCRM version: 4.5.5
  • CMS version: WordPress 4.1
  • MySQL version: 5.1.68
  • PHP version: 5.3
Re: Alter Organization name varchar size
April 05, 2013, 01:06:55 pm
I have never changed the structure of any of the CiviCRM data fields but my experience with MySQL is that increasing the field size does not effect the existing data. Decreasing can cause problems (probably give you an error).

As I said I have never changed the structure of a CiviCRM database so there may be more involved here. As always it is a good idea to do a backup before any change such as this and if you have a test install try it in first that would help.

Hope this helps.

BT

kennedy

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 5
  • CiviCRM version: 4.5.5
  • CMS version: Drupal
  • PHP version: 5.3.10
Re: Alter Organization name varchar size
April 05, 2013, 01:45:25 pm
Thank you for the info, I will test it before applying the changes on my production site.

kennedy

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 5
  • CiviCRM version: 4.5.5
  • CMS version: Drupal
  • PHP version: 5.3.10
Re: Alter Organization name varchar size
April 08, 2013, 12:30:51 am
works just fine.

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Alter Organization name varchar size
April 08, 2013, 02:15:42 am
It goes without saying that you have to do this again once you upgrade :-)
Alternative is to update the size in the civicrm data definitions (xml files) but even then you have to update those manually with every upgrade.
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Alter Organization name varchar size
April 08, 2013, 07:42:03 am

not really. the upgrade does not chnge the schema of fields not affected by the upgrade

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Alter Organization name varchar size
April 08, 2013, 11:16:55 am
I stand corrected :-)  and rightly so....lobo strikes again ;D
What you do have to do with each upgrade is check if organization_name is touched by the upgrade.
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

kennedy

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 5
  • CiviCRM version: 4.5.5
  • CMS version: Drupal
  • PHP version: 5.3.10
Re: Alter Organization name varchar size
April 10, 2013, 01:23:00 am
Hi Erik,
does this mean that data can be lost if the organization_name is touched after upgrade?

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Alter Organization name varchar size
April 10, 2013, 05:27:17 am
Quote
if the organization_name is touched after upgrade

not sure what you mean by the above, but in general what you are doing is not a particularly 'dangerous' thing to do.

If we decided to alter the organization_name field in the upgrade script, depending on how we altered it, it might cause you to loose some information (say if we decided to make it only 100 characters or something like that).  It seems unlikely (though not impossible) that we would do that.

not sure how many other orgs need an org name longer than what we define by default (which i think is 128) but you could always submit a ticket and patch to core to increase the size of that field for all civicrm users. not sure it that is a sensible idea.

http://dev.mysql.com/doc/refman/5.1/en/char.html and http://dev.mysql.com/doc/refman/5.5/en/char.html have a different limit on the length that is allowed for varchar.  5.1 allows 255 it seems so i don't think we can move it any higher than that until we make mysql 5.5 a requirement.

so it looks like the highest we could push this too for the time being is 255.

to be extra safe and do things properly you might want to create an issue and patch to do this...
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Alter Organization name varchar size

This forum was archived on 2017-11-26.