I am appending three new tables in my custom module using hook_update
, but it is throwing below error when I try to run update.php
file
PDOException: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'schema_version' at row 206: UPDATE {system} SET schema_version=:db_update_placeholder_0 WHERE (name = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => 71000 [:db_condition_placeholder_0] => pemedia_library ) in drupal_set_installed_schema_version() (line 181 of H:\xampp\htdocs\brandenglish\trunk\includes\install.inc).
Here is my code
//my module install file
<?php
/**
* @file
* Install, update and uninstall functions for the pemedia_library module.
* https://www.drupal.org/node/876250
*/
/*
* *Implementing hook schema
*/
function pemedia_library_schema() {
/*
* Photographic page table
*/
$schema['pemedia_gallery_table'] = array(
// Example (partial) specification for table "node".
'description' => 'Table for storing information about image media.',
'fields' => array(
'imid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique aggregator image ID.',
),
'image_title' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Title of the media.',
),
'low_res_path' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'CDN url path for low resulution images.',
),
'medium_res_path' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'CDN url path for medium resulution images.',
),
'high_res_path' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'CDN url path for high resulution images.',
),
'description' => array(
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
'description' => 'Description of the image',
),
'bussiness_channel' => array(
'type' => 'varchar',
'length' => 60,
'not null' => TRUE,
'default' => '',
'description' => 'Type of bussiness channel.',
),
'user_right' => array(
'type' => 'varchar',
'length' => 60,
'not null' => TRUE,
'default' => '',
'description' => 'Type of user right.',
),
'geography' => array(
'type' => 'varchar',
'length' => 60,
'not null' => TRUE,
'default' => '',
'description' => 'Geographic location.',
),
'expiry_date_timestamp' => array(
'type' => 'int',
'not null' => FALSE,
'description' => 'Expiry date of image items, as a Unix timestamp.',
),
'usages_restriction' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'information about usages restriction.',
),
'owner' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Information about the owner.',
),
'copyright_information' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Copyright information about the image.',
),
'other_information' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'other information about the image.',
),
'status' => array(
'description' => 'status field for the images',
'type' => 'int',
'length' => 1,
'not null' => TRUE,
'default' => 1,
),
),
'primary key' => array('imid'),
);
/*
* Illustration page table
*/
$schema['pemedia_illustration_table'] = array(
// Example (partial) specification for table "node".
'description' => 'Table for storing information about custom media.',
'fields' => array(
'mid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique aggregator custom media ID.',
),
'media_title' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Title of the custom media.',
),
'illustration_file_path_1' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'CDN url path for first illustration file.',
),
'illustration_file_path_2' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'CDN url path for second illustration file.',
),
'illustration_file_path_3' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'CDN url path for third illustration file..',
),
'description' => array(
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
'description' => 'Description of the custom media',
),
'bussiness_channel' => array(
'type' => 'varchar',
'length' => 60,
'not null' => TRUE,
'default' => '',
'description' => 'Type of bussiness channel.',
),
'user_right' => array(
'type' => 'varchar',
'length' => 60,
'not null' => TRUE,
'default' => '',
'description' => 'Type of user right.',
),
'owner' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Information about the owner.',
),
'file1_size' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'size of the file1.',
),
'file2_size' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'size of the file2.',
),
'file3_size' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'size of the file3.',
),
'status' => array(
'description' => 'status field for the custom media',
'type' => 'int',
'length' => 1,
'not null' => TRUE,
'default' => 1,
),
),
'primary key' => array('mid'),
);
/*
* table schema for application page table
*/
$schema['pemedia_application_page_table'] = array(
'description' => 'Table for storing information about static media asset of applicaton page .',
'fields' => array(
'appid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique aggregator static media asset ID of application page .',
),
'app_content_title' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Title of the static media asset of applicaton page',
),
'app_content_media_type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => 'application',
'description' => 'Media Type for static media asset of applicaton page.',
),
'status' => array(
'description' => 'status field for static media asset of applicaton page',
'type' => 'int',
'length' => 1,
'not null' => TRUE,
'default' => 1,
),
),
'primary key' => array('appid'),
);
/*
* table schema for product logos page table
*/
$schema['pemedia_product_logos_page_table'] = array(
'description' => 'Table for storing information static media asset of product logos page .',
'fields' => array(
'plogosid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique aggregator ID for static media asset of product logos page .',
),
'plogs_content_title' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Title of the static media asset of product logos page .',
),
'plogs_media_type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => 'product_logos',
'description' => 'Media Type for static media asset of product logos page .',
),
'status' => array(
'description' => 'status field of static media asset of product logos page . ',
'type' => 'int',
'length' => 1,
'not null' => TRUE,
'default' => 1,
),
),
'primary key' => array('plogosid'),
);
/*
* Table for User content downloads
*/
$schema['pemedia_user_content_table'] = array(
'description' => 'Table for storing information about User content downlaods.',
'fields' => array(
'uid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique aggregator ID for User content downlaods.',
),
'content_id' => array(
'type' => 'int',
'size' => 'big',
'not null' => TRUE,
'default' => '',
'description' => 'Content Id of contents downloaded by user.',
),
'content_media_type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Media Type of contents downloaded by user.',
),
'status' => array(
'description' => 'status field of contents downloaded by user.',
'type' => 'int',
'length' => 1,
'not null' => TRUE,
'default' => 1,
),
),
'primary key' => array('uid'),
);
return $schema;
}
/**
* Create new database table for static contents {pemedia_application_page_table, pemedia_product_logos_page_table, pemedia_user_content_table}.
*/
function pemedia_library_update_71001() {
/*
* Table for application page
*/
$table1 = array(
'description' => 'Table for storing information about static media asset of applicaton page .',
'fields' => array(
'appid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique aggregator static media asset ID of application page .',
),
'app_content_title' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Title of the static media asset of applicaton page',
),
'app_content_media_type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => 'application',
'description' => 'Media Type for static media asset of applicaton page.',
),
'status' => array(
'description' => 'status field for static media asset of applicaton page',
'type' => 'int',
'length' => 1,
'not null' => TRUE,
'default' => 1,
),
),
'primary key' => array('appid'),
);
/*
* Table for product logos page
*/
$table2 = array(
'description' => 'Table for storing information static media asset of product logos page .',
'fields' => array(
'plogosid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique aggregator ID for static media asset of product logos page .',
),
'plogs_content_title' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Title of the static media asset of product logos page .',
),
'plogs_media_type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => 'product_logos',
'description' => 'Media Type for static media asset of product logos page .',
),
'status' => array(
'description' => 'status field of static media asset of product logos page . ',
'type' => 'int',
'length' => 1,
'not null' => TRUE,
'default' => 1,
),
),
'primary key' => array('plogosid'),
);
/*
* Table for User content downloads
*/
$table3 = array(
'description' => 'Table for storing information about User content downlaods.',
'fields' => array(
'uid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique aggregator ID for User content downlaods.',
),
'content_id' => array(
'type' => 'int',
'size' => 'big',
'not null' => TRUE,
'default' => '',
'description' => 'Content Id of contents downloaded by user.',
),
'content_media_type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Media Type of contents downloaded by user.',
),
'status' => array(
'description' => 'status field of contents downloaded by user.',
'type' => 'int',
'length' => 1,
'not null' => TRUE,
'default' => 1,
),
),
'primary key' => array('uid'),
);
db_create_table('pemedia_application_page_table', $table1);
db_create_table('pemedia_product_logos_page_table', $table2);
db_create_table('pemedia_user_content_table', $table3);
}
Can some one help please. Thanks