Skip navigation.
Home

Drupal: Upgrade Notes

Been upgrading from an old Drupal 4.5 (aka Civicspace 82) to Drupal 5.1.

Dropping CiviCRM

I had to get rid of the unused civicrm tables. Installing it seemed like a good idea at the time, but no point of using it for a tiny campaign. Here's a script that will delete the tables. It's posted here because the InnoDB engine complains if you drop these in the wrong order, and violate some constraints.

drop table if exists `civicrm_activity`;
drop table if exists `civicrm_activity_history`;
drop table if exists `civicrm_activity_type`;
drop table if exists `civicrm_address`;
drop table if exists `civicrm_county`;
drop table if exists `civicrm_custom_option`;
drop table if exists `civicrm_custom_value`;
drop table if exists `civicrm_donation_page`;
drop table if exists `civicrm_email_history`;
drop table if exists `civicrm_entity_tag`;
drop table if exists `civicrm_geo_coord`;
drop table if exists `civicrm_group_contact`;
drop table if exists `civicrm_household`;
drop table if exists `civicrm_im`;
drop table if exists `civicrm_im_provider`;
drop table if exists `civicrm_individual`;
drop table if exists `civicrm_individual_prefix`;
drop table if exists `civicrm_individual_suffix`;
drop table if exists `civicrm_mailing_bounce_pattern`;
drop table if exists `civicrm_mailing_bounce_type`;
drop table if exists `civicrm_mailing_event_bounce`;
drop table if exists `civicrm_mailing_event_confirm`;
drop table if exists `civicrm_mailing_event_delivered`;
drop table if exists `civicrm_mailing_event_forward`;
drop table if exists `civicrm_mailing_event_opened`;
drop table if exists `civicrm_mailing_event_reply`;
drop table if exists `civicrm_mailing_event_subscribe`;
drop table if exists `civicrm_mailing_event_trackable_url_open`;
drop table if exists `civicrm_mailing_event_unsubscribe`;
drop table if exists `civicrm_mailing_group`;
drop table if exists `civicrm_mailing_trackable_url`;
drop table if exists `civicrm_mapping_field`;
drop table if exists `civicrm_meeting`;
drop table if exists `civicrm_note`;
drop table if exists `civicrm_organization`;
drop table if exists `civicrm_phonecall`;
drop table if exists `civicrm_relationship`;
drop table if exists `civicrm_relationship_type`;
drop table if exists `civicrm_state_province`;
drop table if exists `civicrm_subscription_history`;
drop table if exists `civicrm_tag`;
drop table if exists `civicrm_uf_field`;
drop table if exists `civicrm_uf_group`;
drop table if exists `civicrm_uf_match`;
drop table if exists `civicrm_acl`;
drop table if exists `civicrm_acl_group_join`;
drop table if exists `civicrm_country`;
drop table if exists `civicrm_custom_field`;
drop table if exists `civicrm_custom_group`;
drop table if exists `civicrm_gender`;
drop table if exists `civicrm_group`;
drop table if exists `civicrm_mailing_event_queue`;
drop table if exists `civicrm_mailing_job`;
drop table if exists `civicrm_mapping`;
drop table if exists `civicrm_phone`;
drop table if exists `civicrm_saved_search`;
drop table if exists `civicrm_validation`;
drop table if exists `civicrm_acl_group`;
drop table if exists `civicrm_contact`;
drop table if exists `civicrm_email`;
drop table if exists `civicrm_location`;
drop table if exists `civicrm_location_type`;
drop table if exists `civicrm_mailing`;
drop table if exists `civicrm_mailing_component`;
drop table if exists `civicrm_mobile_provider`;
drop table if exists `civicrm_domain`;

Feed it into mysql's command line tool like this:

mysql -u username -pPassword database_name < file_containing_the_text_from_above

UTF8

I wanted to update the system to use utf8 all over the place. Here's a script that will convert a database in latin9, or whatever other character set, and turn it into the utf8 character set with utf8_general_ci collation:

#! /usr/bin/perl

use DBI;

if (! $ARGV[0]) {
print("usage: fix_collation <database>\n");
exit;
}

$database = $ARGV[0];

our $dsn = "DBI:mysql:database=$database;host=localhost";

our $dbh = DBI->connect($dsn, 'root', 'rootpass');

our $resultar = $dbh->selectall_arrayref('SHOW TABLES');

map {
my $table = ${$_}[0];
my $sql = "ALTER TABLE `$table` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci";
$dbh->do($sql);
} @$resultar;

Google Search