You are here

function mailchimp_ecommerce_schema in Mailchimp E-Commerce 8

Same name and namespace in other branches
  1. 7 mailchimp_ecommerce.install \mailchimp_ecommerce_schema()

Implements hook_schema().

File

./mailchimp_ecommerce.install, line 13
Install, update and uninstall functions for the mailchimp_ecommerce module.

Code

function mailchimp_ecommerce_schema() {
  $schema['mailchimp_ecommerce_customer'] = [
    'description' => 'Maintains a connection between carts, orders and a Mailchimp customer.',
    'fields' => [
      'mailchimp_customer_id' => [
        'description' => 'Primary Key (unique ID).',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'mail' => [
        'description' => 'The customer email.',
        'type' => 'varchar',
        'length' => 254,
        'not null' => FALSE,
      ],
      'orders_count' => [
        'type' => 'int',
        'description' => 'Total orders for this customer.',
        'unsigned' => TRUE,
        'default' => 0,
      ],
      'total_spent' => [
        'type' => 'numeric',
        'description' => 'Total amount spent by this customer.',
        'unsigned' => TRUE,
        'precision' => 19,
        'scale' => 6,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'mailchimp_customer_id',
    ],
    'indexes' => [
      'mail' => [
        'mail',
      ],
    ],
  ];
  return $schema;
}