<?php

/**
 * add {learning} table
 */
function diy_code_update_7200() {
    $schema['diy_js_learning'] = array(
        'description' => 'diy aggregation learning table',
        'fields' => array(
            'id' => array('type' => 'serial', 'not null' => true),
            'timestamp' => array('type' => 'int', 'not null' => true),
            'cachekey' => array('type' => 'varchar', 'length' => 256, 'not null' => true),
            'url' => array('type' => 'text', 'not null' => true),
            'learned' => array('type' => 'text', 'not null' => true)
        ),
        'primary key' => array('id'),
    );
    db_create_table('diy_js_learning', $schema['diy_js_learning']);  // THIS IS SAFE BECAUSE $schema IS EXPLICIT
}


/**
 * add originalUrl column to {learning} table
 */
function diy_code_update_7201() {
    db_add_field('diy_js_learning', 'originalUrl', array('type' => 'text', 'not null' => true, 'initial' => ''));
}
