mutual_credit-5.0.x-dev/modules/clearingcentral/mcapi_cc.install

modules/clearingcentral/mcapi_cc.install
<?php

use Drupal\mcapi\Entity\Wallet;
use Drupal\user\Entity\User;

/**
 * Implements hook_install().
 *
 * Make an intertrading wallet for user 1 and every exchange
 */
function mcapi_cc_install() {
  // Create an intertrading wallet on user 1.
  Wallet::create([
    'holder' => User::load(1),
    'name' => INTERTRADING_WALLET_NAME
  ])->save();
}

/**
 * Implements hook_schema().
 */
function mcapi_cc_schema() {
  $schema = array();
  $schema['mcapi_cc'] = array(
    'description' => 'Community Exchange network transaction ids.',
    'fields' => array(
      'xid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'serial' => array(
        'type' => 'varchar',
        'length' => '32',
        'not null' => TRUE,
        'default' => '',
      ),
      'txid' => array(
        'description' => 'the clearing central transaction id',
        'type' => 'varchar',
        'length' => '36',
        'not null' => TRUE,
        'default' => '',
      ),
      'exchange_id' => array(
        'description' => 'the seven char code of the exchange in clearing central',
        'type' => 'varchar',
        'length' => '7',
        'not null' => TRUE,
        'default' => '',
      ),
      'user_id' => array(
        'description' => 'the remote users id in the remote system',
        'type' => 'varchar',
        'length' => '32',
        'not null' => TRUE,
        'default' => '',
      ),
      'user_name' => array(
        'description' => 'the remote users name at the time of the transaction',
        'type' => 'varchar',
        'length' => '32',
        'default' => '',
      ),
      'user_mail' => array(
        'description' => 'the remote users email at the time of the transaction',
        'type' => 'varchar',
        'length' => '64',
        'default' => '',
      ),
    ),
    'primary key' => array('serial'),
    'unique keys' => array(
      'serial' => array('serial'),
      'txid' => array('txid')
    ),
  );
  return $schema;
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc