rename table and fields to remove _regn for earlyaccess codes

This commit is contained in:
2017-06-29 15:45:11 +10:00
parent acfbd806ef
commit ac8ed27d63
3 changed files with 56 additions and 19 deletions

View File

@@ -635,17 +635,17 @@ function booking_update_7242() {
db_add_field('booking_person', 'booking_earlyaccess_code_id', $spec);
//create new table to store the valid codes
$booking_regn_earlyaccess_codes = array(
$booking_earlyaccess_codes = array(
'fields' => array(
'cid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_regn_earlyaccess_code' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_regn_earlyaccess_code_avail' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_earlyaccess_code' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_earlyaccess_code_avail' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
),
'primary key' => array('cid'),
);
db_create_table('booking_regn_earlyaccess_codes', $booking_regn_earlyaccess_codes);
db_create_table('booking_earlyaccess_codes', $booking_earlyaccess_codes);
//update the view to match the new table definition
_booking_node_create_mysqlview();
@@ -660,6 +660,32 @@ function booking_update_7243() {
variable_set('mail_system', array_merge($current, $addition));
}
/**
* Rename booking_earlyaccess_code_id in booking_person table to booking_earlyaccess_code
*/
function booking_update_7244() {
$spec = array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE);
db_change_field('booking_person', 'booking_earlyaccess_code_id', 'booking_earlyaccess_code', $spec);
db_drop_table('booking_regn_earlyaccess_codes');
//create new table to store the valid codes
$booking_earlyaccess_codes = array(
'fields' => array(
'cid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_earlyaccess_code' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_earlyaccess_code_avail' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
),
'primary key' => array('cid'),
);
db_create_table('booking_earlyaccess_codes', $booking_earlyaccess_codes);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/**
* Implementation of hook_install().
*/
@@ -730,7 +756,7 @@ function booking_schema() {
'nid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
'booking_tempid' => array('type' => 'varchar', 'length' => '40', 'not null' => FALSE),
'booking_earlyaccess_code_id' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
'booking_earlyaccess_code' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
'booking_timestamp' => array('type' => 'int', 'not null' => TRUE, 'disp-width' => '11'),
'booking_firstname' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE),
'booking_lastname' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE),
@@ -1045,12 +1071,12 @@ function booking_schema() {
);
//This lists all the early registration access codes
$schema['booking_regn_earlyaccess_codes'] = array(
$schema['booking_earlyaccess_codes'] = array(
'fields' => array(
'cid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_regn_earlyaccess_code' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_regn_earlyaccess_code_avail' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_earlyaccess_code' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_earlyaccess_code_avail' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
),
'primary key' => array('cid'),
);