You are here

function uc_addresses_schema in Ubercart Addresses 6

Same name and namespace in other branches
  1. 6.2 uc_addresses.install \uc_addresses_schema()
  2. 7 uc_addresses.install \uc_addresses_schema()

Implementation of hook_schema().

File

./uc_addresses.install, line 10
Installation file of Ubercart Addresses

Code

function uc_addresses_schema() {
  $schema['uc_addresses'] = array(
    'description' => t('Ubercart customer addresses'),
    'fields' => array(
      'aid' => array(
        'description' => t('The address ID'),
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'uid' => array(
        'description' => t('The ID of the user who owns this address'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'first_name' => array(
        'description' => t('The addressee\'s first name'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'last_name' => array(
        'description' => t('The addressee\'s last name'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'phone' => array(
        'description' => t('The addressee\'s phone number'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'company' => array(
        'description' => t('The addressee\'s company name'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'street1' => array(
        'description' => t('The addressee\'s residence number and street'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'street2' => array(
        'description' => t('The addressee\'s residence number and street (continued)'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'city' => array(
        'description' => t('The addressee\'s city of residence'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'zone' => array(
        'description' => t('The addressee\'s zone of residence'),
        'type' => 'int',
        'size' => 'medium',
        'not null' => TRUE,
        'default' => 0,
      ),
      'postal_code' => array(
        'description' => t('The addressee\'s postal code'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'country' => array(
        'description' => t('The addressee\'s country of residence'),
        'type' => 'int',
        'size' => 'medium',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'address_name' => array(
        'description' => t('The name used to access this address'),
        'type' => 'varchar',
        'length' => 20,
        'not null' => FALSE,
      ),
      'created' => array(
        'description' => t('The date this address was created'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'modified' => array(
        'description' => t('The date this address was last modified'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'aid_uid_idx' => array(
        'aid',
        'uid',
      ),
    ),
    'primary key' => array(
      'aid',
    ),
  );
  $schema['uc_addresses_defaults'] = array(
    'description' => t('Associates a user with an address: the default address'),
    'fields' => array(
      'aid' => array(
        'description' => t('The ID of the address in the uc_adresses table'),
        'type' => 'int',
        'unsigned' => 1,
        'not null' => TRUE,
      ),
      'uid' => array(
        'description' => t('The ID of the user'),
        'type' => 'int',
        'unsigned' => 1,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'aid',
      'uid',
    ),
  );
  return $schema;
}