You are here

function availability_calendars_update_6101 in Availability Calendars 6

Same name and namespace in other branches
  1. 6.2 availability_calendars.install \availability_calendars_update_6101()

Update availability_calendars_day table to add date field.

File

./availability_calendars.install, line 126
Install, update and uninstall functions for the Availability Calendars module.

Code

function availability_calendars_update_6101() {
  $ret = array();
  db_add_field($ret, 'availability_calendars_day', 'date', array(
    'type' => 'datetime',
    'not null' => FALSE,
  ));
  $ret[] = update_sql("UPDATE {availability_calendars_day} SET date = CAST(CONCAT(year, '-', month, '-', day, ' 12:00:00') as DATETIME)", $date);
  $ret[] = array(
    'success' => TRUE,
    'query' => 'Recalculated date column for ' . db_affected_rows() . ' availability calendar entries.',
    'rows' => db_affected_rows(),
  );
  return $ret;
}