<?php

/**
 * @file
 * Install file.
 */

/**
 * Implements hook_schema().
 */
function diy_meta_alternate_schema() {
  $schema['diy_domain_countrycode'] = array(
    'description' => 'The base table for additional domain information',
    'fields' => array(
      'domain_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'Domain numeric id.'),
      'countrycode' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => '', 'description' => 'Country code'),
      'enabled' => array('type' => 'int', 'length' => '1', 'not null' => TRUE, 'default' => '0', 'description' => 'Enabled or Disabled'),
    ),
    'primary key' => array('domain_id'),
    'indexes' => array(),
    'foreign_keys' => array(
      'domain_id' => array('domain_export' => 'domain_id')
    ),
  );

  return $schema;
}

/**
 * Adds diy_domain_view table for storing which view exposes link-alternate-metatags
 */
function diy_meta_alternate_update_7302() {
  if (!db_table_exists('diy_domain_view')) {
    $schema = array(
        'description' => 'The base table for enabling meta tags on views',
        'fields' => array(
          'view_id' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => '', 'description' => 'View machine readable id.'),
          'enabled' => array('type' => 'int', 'length' => '1', 'not null' => TRUE, 'default' => '0', 'description' => 'Enabled or Disabled'),
        ),
        'primary key' => array('view_id'),
        'indexes' => array(),
        'foreign_keys' => array(
          'view_id' => array('views_view' => 'name')
        )
    );
    db_create_table('diy_domain_view', $schema);
  }

}