add node id to earlyaccess codes table

This commit is contained in:
2017-06-29 16:19:49 +10:00
parent 13f5125ccc
commit 7df9904aaf
2 changed files with 13 additions and 1 deletions

View File

@@ -673,6 +673,7 @@ function booking_update_7244() {
'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),
'booking_earlyaccess_code_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
),
'primary key' => array('cid'),
);
@@ -693,6 +694,15 @@ function booking_update_7245() {
_booking_node_create_mysqlview();
}
/**
* Add node id to booking_earlyaccess_codes table
*/
function booking_update_7246() {
$spec = array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10');
db_add_field('booking_earlyaccess_codes', 'booking_earlyaccess_code_nid', $spec);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/**
@@ -1086,6 +1096,7 @@ function booking_schema() {
'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),
'booking_earlyaccess_code_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
),
'primary key' => array('cid'),
);

View File

@@ -1308,7 +1308,8 @@ function _booking_form_submit_post_triggers($node)
//update the database to mark the code as being unavailable
db_update('booking_earlyaccess_codes')->fields(array(
'booking_earlyaccess_code_avail' => 'N'
'booking_earlyaccess_code_avail' => 'N',
'booking_earlyaccess_code_nid' => $node->nid,
))->condition('cid', $node->booking_earlyaccess_code_id)->execute();
}