You are here

function invoice_schema in Invoice 7

Same name and namespace in other branches
  1. 6 invoice.install \invoice_schema()

Implementation of hook_schema()

Return value

array

File

./invoice.install, line 101

Code

function invoice_schema() {
  $schema['invoice_customers'] = array(
    'fields' => array(
      'cid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'customer_number' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'company_name' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'firstname' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => FALSE,
      ),
      'lastname' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => FALSE,
      ),
      'street' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'building_number' => array(
        'type' => 'varchar',
        'length' => 15,
        'not null' => FALSE,
      ),
      'zipcode' => array(
        'type' => 'varchar',
        'length' => 25,
        'not null' => FALSE,
      ),
      'city' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => FALSE,
      ),
      'state' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => FALSE,
      ),
      'country' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => FALSE,
      ),
      'coc_number' => array(
        'type' => 'varchar',
        'length' => 25,
        'not null' => FALSE,
      ),
      'vat_number' => array(
        'type' => 'varchar',
        'length' => 25,
        'not null' => FALSE,
      ),
      'description' => array(
        'type' => 'text',
        'not null' => FALSE,
      ),
      'invoice_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'cid',
    ),
    'unique keys' => array(),
    'indexes' => array(
      'invoice_id' => array(
        'invoice_id',
      ),
      'customer_number' => array(
        'customer_number',
      ),
    ),
  );
  $schema['invoice_invoices'] = array(
    'fields' => array(
      'iid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'leading_zeros' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'prefix' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => FALSE,
      ),
      'description' => array(
        'type' => 'text',
        'not null' => FALSE,
      ),
      'tid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'pay_limit' => array(
        'type' => 'int',
        'size' => 'small',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'pay_status' => array(
        'type' => 'varchar',
        'length' => 10,
        'not null' => TRUE,
        'default' => 'unpaid',
      ),
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'iid',
    ),
    'unique keys' => array(
      'nid' => array(
        'nid',
      ),
    ),
    'indexes' => array(
      'tid' => array(
        'tid',
      ),
      'uid' => array(
        'uid',
      ),
    ),
  );
  $schema['invoice_items'] = array(
    'fields' => array(
      'iid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'description' => array(
        'type' => 'text',
        'size' => 'medium',
        'not null' => FALSE,
      ),
      'quantity' => array(
        'type' => 'float',
        'size' => 'big',
        'not null' => TRUE,
        'default' => 0,
      ),
      'unitcost' => array(
        'type' => 'float',
        'size' => 'big',
        'not null' => TRUE,
        'default' => 0,
      ),
      'vat' => array(
        'type' => 'float',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'weight' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => FALSE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'invoice_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
      'created' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'iid',
    ),
    'unique keys' => array(),
    'indexes' => array(
      'invoice_id' => array(
        'invoice_id',
      ),
      'uid' => array(
        'uid',
      ),
    ),
  );
  $schema['invoice_templates'] = array(
    'fields' => array(
      'tid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'api_username' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'locale' => array(
        'type' => 'varchar',
        'length' => '25',
        'not null' => FALSE,
      ),
      'date_format' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => FALSE,
      ),
      'vat' => array(
        'type' => 'float',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'pay_limit' => array(
        'type' => 'int',
        'size' => 'small',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'supplier_company_name' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'supplier_street' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'supplier_building_number' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'supplier_zipcode' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'supplier_city' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'supplier_state' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'supplier_country' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'supplier_phone' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'supplier_fax' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'supplier_email' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'supplier_web' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'supplier_coc_number' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'supplier_vat_number' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
      ),
      'display_column_vat' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'display_column_exunitcost' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
      'display_column_incunitcost' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
      'display_column_extotal' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
      'display_column_inctotal' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
    ),
    'primary key' => array(
      'tid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
    'indexes' => array(),
  );
  return $schema;
}