record_shorten.install in Shorten URLs 6
Same filename and directory in other branches
Records shortened URLs.
File
record_shorten.installView source
<?php
/**
* @file
* Records shortened URLs.
*/
/**
* Implementation of hook_schema().
*/
function record_shorten_schema() {
$schema = array();
$schema['record_shorten'] = array(
'description' => 'Records shortened URLs.',
'fields' => array(
'sid' => array(
'type' => 'serial',
'not null' => TRUE,
'unsigned' => TRUE,
'description' => 'The ID of the shortened URL.',
),
'original' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The original (long) URL.',
),
'short' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The new (short) URL.',
),
'service' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The service used to shorten the URL.',
),
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The User ID of the user who created the shortened URL.',
),
'hostname' => array(
'description' => 'The IP address of the user who created the shortened URL.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'created' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The time the shortened URL was created.',
),
),
'indexes' => array(
'sid' => array(
'sid',
),
),
'primary key' => array(
'sid',
),
);
return $schema;
}
/**
* Implementation of hook_install().
*/
function record_shorten_install() {
drupal_install_schema('record_shorten');
}
/**
* Implementation of hook_uninstall().
*/
function record_shorten_uninstall() {
drupal_uninstall_schema('record_shorten');
}
/**
* Implementation of hook_update_N().
*/
function record_shorten_update_6101() {
$ret = array();
$schema = array(
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The User ID of the user who created the shortened URL.',
),
'hostname' => array(
'description' => 'The IP address of the user who created the shortened URL.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'created' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The time the shortened URL was created.',
),
);
db_add_field($ret, 'record_shorten', 'uid', $schema['uid']);
db_add_field($ret, 'record_shorten', 'hostname', $schema['hostname']);
db_add_field($ret, 'record_shorten', 'created', $schema['created']);
return $ret;
}
Functions
Name | Description |
---|---|
record_shorten_install | Implementation of hook_install(). |
record_shorten_schema | Implementation of hook_schema(). |
record_shorten_uninstall | Implementation of hook_uninstall(). |
record_shorten_update_6101 | Implementation of hook_update_N(). |