You are here

function uc_addresses_schema in Ubercart Addresses 7

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

Implements hook_schema().

File

./uc_addresses.install, line 11
Install file for Ubercart Addresses.

Code

function uc_addresses_schema() {
  $schema['uc_addresses'] = array(
    'description' => 'Ubercart customer addresses',
    'fields' => array(
      'aid' => array(
        'description' => 'The address ID',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'uid' => array(
        'description' => 'The ID of the user who owns this address',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'first_name' => array(
        'description' => 'The addressee\'s first name',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'last_name' => array(
        'description' => 'The addressee\'s last name',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'phone' => array(
        'description' => 'The addressee\'s phone number',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'company' => array(
        'description' => 'The addressee\'s company name',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'street1' => array(
        'description' => 'The addressee\'s residence number and street',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'street2' => array(
        'description' => 'The addressee\'s residence number and street (continued)',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'city' => array(
        'description' => 'The addressee\'s city of residence',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'zone' => array(
        'description' => 'The addressee\'s zone of residence',
        'type' => 'int',
        'size' => 'medium',
        'not null' => TRUE,
        'default' => 0,
      ),
      'postal_code' => array(
        'description' => 'The addressee\'s postal code',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'country' => array(
        'description' => 'The addressee\'s country of residence',
        'type' => 'int',
        'size' => 'medium',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'address_name' => array(
        'description' => 'The name used to access this address',
        'type' => 'varchar',
        'length' => 20,
        'not null' => FALSE,
      ),
      'default_shipping' => array(
        'description' => 'If the address is the default shipping address',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'default_billing' => array(
        'description' => 'If the address is the default billing address',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'created' => array(
        'description' => 'The date this address was created',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'modified' => array(
        'description' => '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',
    ),
  );
  return $schema;
}