You are here

fillpdf.install in FillPDF 6

Install

File

fillpdf.install
View source
<?php

/**
 * @file
 * Install
 */
function fillpdf_schema() {
  $schema = array();
  $schema['fillpdf_forms'] = array(
    'fields' => array(
      'fid' => array(
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'url' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'destination_path' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'replacements' => array(
        'type' => 'text',
        'size' => 'normal',
        'not null' => FALSE,
      ),
      'destination_redirect' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'fid',
    ),
  );
  $schema['fillpdf_fields'] = array(
    'fields' => array(
      'fid' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
      'pdf_key' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'label' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'value' => array(
        'type' => 'text',
        'size' => 'medium',
        'not null' => TRUE,
      ),
      'replacements' => array(
        'type' => 'text',
        'size' => 'normal',
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'fid',
      'pdf_key',
    ),
  );
  return $schema;
}
function fillpdf_install() {
  drupal_install_schema('fillpdf');
}

/**
 * Add the destination_path field to {fillpdf_forms}.
 */
function fillpdf_update_6001() {
  $ret = array();
  db_add_field($ret, 'fillpdf_forms', 'destination_path', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => FALSE,
  ));
  return $ret;
}

/**
 * Add the replacements field to {fillpdf_forms} and {fillpdf_fields}.
 */
function fillpdf_update_6002() {
  $ret = array();
  db_add_field($ret, 'fillpdf_forms', 'replacements', array(
    'type' => 'text',
    'size' => 'normal',
    'not null' => FALSE,
  ));
  db_add_field($ret, 'fillpdf_fields', 'replacements', array(
    'type' => 'text',
    'size' => 'normal',
    'not null' => FALSE,
  ));
  return $ret;
}

/**
 * The people have spoken. Improve PostgreSQL support, at last.
 */
function fillpdf_update_6003() {
  $ret = array();
  db_drop_primary_key($ret, 'fillpdf_forms');
  db_change_field($ret, 'fillpdf_forms', 'fid', 'fid', array(
    'type' => 'serial',
    'not null' => TRUE,
  ), array(
    'primary key' => array(
      'fid',
    ),
  ));
  db_drop_primary_key($ret, 'fillpdf_fields');
  db_change_field($ret, 'fillpdf_fields', 'fid', 'fid', array(
    'type' => 'int',
    'not null' => TRUE,
  ), array(
    'primary key' => array(
      'fid',
      'pdf_key',
    ),
  ));
  return $ret;
}

/**
 * Add database field to hold "Redirect to saved file" setting.
 */
function fillpdf_update_6004() {
  $ret = array();
  db_add_field($ret, 'fillpdf_forms', 'destination_redirect', array(
    'type' => 'int',
    'size' => 'tiny',
    'unsigned' => TRUE,
    'not null' => FALSE,
  ));
  return $ret;
}
function fillpdf_uninstall() {
  drupal_uninstall_schema('fillpdf');
}

Functions

Namesort descending Description
fillpdf_install
fillpdf_schema @file Install
fillpdf_uninstall
fillpdf_update_6001 Add the destination_path field to {fillpdf_forms}.
fillpdf_update_6002 Add the replacements field to {fillpdf_forms} and {fillpdf_fields}.
fillpdf_update_6003 The people have spoken. Improve PostgreSQL support, at last.
fillpdf_update_6004 Add database field to hold "Redirect to saved file" setting.