You are here

agreement.install in Agreement 3.0.x

Install, update and uninstall functions for Agreement module.

File

agreement.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for Agreement module.
 */

/**
 * Implements hook_install().
 */
function agreement_install() {

  // Set module weight.
  module_set_weight('agreement', 9999);
}

/**
 * Implements hook_schema().
 */
function agreement_schema() {
  $schema['agreement'] = array(
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
        'default' => 'default',
      ),
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'agreed' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'sid' => array(
        'type' => 'varchar',
        'length' => 100,
      ),
      'agreed_date' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'indexes' => array(
      'type_uid' => array(
        'type',
        'uid',
      ),
    ),
  );
  return $schema;
}

/**
 * 8200: Updates length of {agreement.sid} column.
 */
function agreement_update_8200() {
  $schema = \Drupal::database()
    ->schema();
  $schema
    ->changeField('agreement', 'sid', 'sid', [
    'type' => 'varchar',
    'length' => 100,
  ]);
}

Functions

Namesort descending Description
agreement_install Implements hook_install().
agreement_schema Implements hook_schema().
agreement_update_8200 8200: Updates length of {agreement.sid} column.