function uc_order_schema in Ubercart 8.4
Same name and namespace in other branches
- 6.2 uc_order/uc_order.install \uc_order_schema()
- 7.3 uc_order/uc_order.install \uc_order_schema()
Implements hook_schema().
File
- uc_order/
uc_order.install, line 13 - Install, update and uninstall functions for the uc_order module.
Code
function uc_order_schema() {
$schema = [];
$schema['uc_order_admin_comments'] = [
'description' => 'Comments on orders that only administrators can see.',
'fields' => [
'comment_id' => [
'description' => 'Primary key: the comment ID.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
'order_id' => [
'description' => 'The {uc_orders}.order_id of the order.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'uid' => [
'description' => 'The {user}.uid of the author of the comment.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'message' => [
'description' => 'The comment body.',
'type' => 'text',
],
'created' => [
'description' => 'The Unix timestamp indicating when the comment was created.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
],
],
'indexes' => [
'order_id' => [
'order_id',
],
],
'primary key' => [
'comment_id',
],
'foreign keys' => [
'uc_orders' => [
'table' => 'uc_orders',
'columns' => [
'order_id' => 'order_id',
],
],
'users' => [
'table' => 'users',
'columns' => [
'uid' => 'uid',
],
],
],
];
$schema['uc_order_comments'] = [
'description' => 'Comments on the order that the customer can see.',
'fields' => [
'comment_id' => [
'description' => 'Primary key: the comment ID.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
'order_id' => [
'description' => 'The {uc_orders}.order_id of the order.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'uid' => [
'description' => 'The {users}.uid of the user who made the comment.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'order_status' => [
'description' => 'The status the order had when the comment was made.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
],
'notified' => [
'description' => 'A flag indicating whether the comment was emailed to the customer. 1 => Yes. 0 => No.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
],
'message' => [
'description' => 'The comment body.',
'type' => 'text',
],
'created' => [
'description' => 'The Unix timestamp indicating when the comment was created.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
],
],
'indexes' => [
'order_id' => [
'order_id',
],
],
'primary key' => [
'comment_id',
],
'foreign keys' => [
'uc_orders' => [
'table' => 'uc_orders',
'columns' => [
'order_id' => 'order_id',
],
],
'users' => [
'table' => 'users',
'columns' => [
'uid' => 'uid',
],
],
],
];
$schema['uc_order_line_items'] = [
'description' => 'Order line items other than products.',
'fields' => [
'line_item_id' => [
'description' => 'Primary key: the line item ID.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
'order_id' => [
'description' => 'The {uc_orders}.order_id.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'type' => [
'description' => 'The line item type.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
],
'title' => [
'description' => 'The label of the line item.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
],
'amount' => [
'description' => "The amount of the line item in the store's currency.",
'type' => 'numeric',
'precision' => 16,
'scale' => 5,
'not null' => TRUE,
'default' => 0.0,
],
'weight' => [
'description' => 'The sort criteria of line items.',
'type' => 'int',
'size' => 'small',
'not null' => TRUE,
'default' => 0,
],
'data' => [
'description' => 'A serialized array of extra data.',
'type' => 'text',
'serialize' => TRUE,
],
],
'indexes' => [
'order_id' => [
'order_id',
],
],
'primary key' => [
'line_item_id',
],
'foreign keys' => [
'uc_orders' => [
'table' => 'uc_orders',
'columns' => [
'order_id' => 'order_id',
],
],
],
];
$schema['uc_order_log'] = [
'description' => 'Record of changes made to an order.',
'fields' => [
'order_log_id' => [
'description' => 'Primary key: the log entry ID.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
'order_id' => [
'description' => 'The {uc_orders}.order_id.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'uid' => [
'description' => 'The {users}.uid of the user who made the changes.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'changes' => [
'description' => 'The description of what was changed.',
'type' => 'text',
],
'created' => [
'description' => 'The Unix timestamp indicating when the change was made.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
],
],
'indexes' => [
'order_id' => [
'order_id',
],
],
'primary key' => [
'order_log_id',
],
'foreign keys' => [
'uc_orders' => [
'table' => 'uc_orders',
'columns' => [
'order_id' => 'order_id',
],
],
'users' => [
'table' => 'users',
'columns' => [
'uid' => 'uid',
],
],
],
];
return $schema;
}