cbr-1.0.0/cbr.install

cbr.install
<?php

/*
* Create two tables for the cbr module
* - cbr_similarity: Stores the similarity between two cases
* - cbr_calculation_queue: Stores the cases that need to be calculated
*/
function cbr_schema(): array
{
    $schema['cbr_similarity'] = [
        'description' => 'Stores the similarity between two cases.',
        'fields' => [
            'nid1' =>   [
                'description' => 'The first case for the similarity.',
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
            ],
            'nid2' =>  [
                'description' => 'The second case for the similarity.',
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
            ],
            'similarity' => [
                'description' => 'The similarity  between case 1 and case 2.',
                'type' => 'float',
                'unsigned' => TRUE,
                'not null' => TRUE,
            ],
        ],
        'primary key' => ['nid1', 'nid2'],
    ];

    $schema['cbr_calculation_queue'] = [
        'description' => 'Cases that need a new similarity calculation.',
        'fields' => [
            'nid' =>   [
                'description' => 'The case to be calculated.',
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
            ],
            'updated' =>  [
                'description' => 'The time when the case was last updated.',
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
            ],
        ],
        'primary key' => ['nid'],
    ];

    return $schema;
}

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

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