<?php

/**
 * @file
 */

function stormdok_install() {
  drupal_install_schema('stormdok');
  variable_set('node_options_stormdok', array('status'));
}

function stormdok_disable() {
  drupal_set_message(t('Nodes of type "Dok" have not been deleted on disabling SuiteDesk Dok. Please note that they will now have reduced functionality, and will not be protected by SuiteDesk Dok access controls.'), 'warning');
}

function stormdok_uninstall() {
  drupal_uninstall_schema('stormdok');
}

function stormdok_schema() {
  $schema['stormdok'] = array(
    'fields'                => array(
      'vid'                 => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'nid'                 => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'organization_nid'    => array('type' => 'int'),
      'organization_title'  => array('type' => 'varchar', 'length' => 128),
      'project_nid'         => array('type' => 'int'),
      'project_title'       => array('type' => 'varchar', 'length' => 128),
      'task_nid'            => array('type' => 'int'),
      'task_title'          => array('type' => 'varchar', 'length' => 128),
      'version'             => array('type' => 'varchar', 'length' => 12),
      'dok_access'          => array('type' => 'int', 'default' => 0),
    ),
    'primary key' => array('vid'),
    'indexes'     => array(
      'nid'               => array('nid'),
      'organization_nid'  => array('organization_nid'),
      'project_nid'       => array('project_nid'),
      'task_nid'          => array('task_nid'),
    ),
  );

  return $schema;
}
