I have written this schema for creating 2 tables in my custom module.install
<?php
function my_registration_form_schema() {
$schema = array();
$schema['myuser'] = array
(
'description' => t('The table containing users who have signed up for the chance to register.'),
'fields' => array
(
'id' => array
(
'description' => t('Primary Key ID'),
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'first_name' => array
(
'description' => t('User\'s First Name'),
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'last_name' => array
(
'description' => t('User\'s Last Name'),
'type' => 'varchar',
'length' => 255,
),
'email_address' => array
(
'description' => t('User\'s Email Address'),
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'user_country' => array
(
'description' => t('Country name of user'),
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
),
'user_city' => array
(
'description' => t('City name of user'),
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
),
'address' => array
(
'description' => t('User address'),
'type' => 'varchar',
'length'=>600,
'not null' => TRUE,
),
'gender' => array
(
'description' => t('User gender'),
'type' => 'varchar',
'length'=>10,
'not null' => TRUE,
),
),
'primary key' => array( 'id' ),
);
$schema['userdata'] = array
(
'description' => t('The table containing additional data about user.'),
'fields' => array
(
'id' => array
(
'description' => t('Primary Key ID'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'subscribe' => array
(
'description' => t('User Subscription'),
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'dob' => array
(
'description' => t('User date of birth'),
'type' => 'varchar',
'length'=>15,
'not null'=>TRUE,
),
),
'primary key' => array( 'id' ),
);
// Return the Table Schema
return $schema;
}
When I had only one table, myuser, it was working good. Now Its not.. What is wrong with code. Please Help
$schema = array();
in your line 3, to see what will happen...