You are here

gauth_user.install in Google Auth 7

Same filename and directory in other branches
  1. 7.2 gauth_user/gauth_user.install

Install and uninstall functions for the Google Auth User module.

File

gauth_user/gauth_user.install
View source
<?php

/**
 * @file
 * Install and uninstall functions for the Google Auth User module.
 */

/**
 * Implements hook_schema().
 */
function gauth_user_schema() {
  $schema['gauth_user_services'] = array(
    'description' => 'Google services enabled for end user.',
    'fields' => array(
      'id' => array(
        'description' => 'The service machine name.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => 'The service name.  Will be visible to end user',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'developer_key' => array(
        'description' => 'The api key of the service.',
        'type' => 'varchar',
        'length' => 255,
        'default' => '',
      ),
      'client_id' => array(
        'description' => 'The Client Id of the service.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'client_secret' => array(
        'description' => 'The Client Secret Id of the service.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'services' => array(
        'description' => 'Services which will be enabled for this account.',
        'type' => 'text',
      ),
      'access_type' => array(
        'description' => 'Stores the access type of the account',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => 'offline',
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  return $schema;
}

/**
 * Implements hook_install().
 */
function gauth_user_install() {
  drupal_install_schema('gauth_user_services');
}

/**
 * Implements hook_uninstall().
 */
function gauth_user_uninstall() {
  drupal_uninstall_schema('gauth_user_services');
}

/**
 * Add the gauth_accounts.access_type field.
 */
function gauth_user_update_7001() {
  $field = array(
    'type' => 'varchar',
    'not null' => TRUE,
    'length' => 255,
    'default' => 'offline',
    'description' => 'Stores the access type of the account.',
  );
  db_add_field('gauth_user_services', 'access_type', $field);
  db_update('gauth_user_services')
    ->fields(array(
    'access_type' => 'offline',
  ))
    ->execute();
}

Functions

Namesort descending Description
gauth_user_install Implements hook_install().
gauth_user_schema Implements hook_schema().
gauth_user_uninstall Implements hook_uninstall().
gauth_user_update_7001 Add the gauth_accounts.access_type field.