You are here

function rooms_booking_update_7004 in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Create owner field in rooms_booking table.

File

modules/rooms_booking/rooms_booking.install, line 304
Sets up the base table for our entity and a table to store information about the entity types.

Code

function rooms_booking_update_7004() {
  db_add_field('rooms_bookings', 'uid', array(
    'description' => 'The {users}.uid that owns this booking.',
    'type' => 'int',
    'not null' => TRUE,
    'default' => 0,
  ));
  db_add_index('rooms_bookings', 'uid', array(
    'uid',
  ));

  // Set all the bookings owned by admin user.
  db_update('rooms_bookings')
    ->fields(array(
    'uid' => 1,
  ))
    ->execute();
  return t('New columns added to rooms_units table');
}