development_environment.install in Development Environment 8
Same filename and directory in other branches
Installation, and update hooks for the Development Environment module.
File
development_environment.installView source
<?php
/**
* @file
* Installation, and update hooks for the Development Environment module.
*/
use Drupal\Core\Database\Database;
/**
* Implements hook_schema().
*/
function development_environment_schema() {
$schema['development_environment_log'] = [
'description' => 'Email logs stored by the development environment module',
'fields' => [
'lid' => [
'description' => 'The unique Log ID of the log item',
'type' => 'serial',
'not null' => TRUE,
],
'email_data' => [
'description' => 'The Drupal email data',
'type' => 'text',
'not null' => TRUE,
],
'timestamp' => [
'description' => 'The UNIX timestamp at which the email was logged',
'type' => 'int',
'length' => 10,
'not null' => TRUE,
'unsigned' => TRUE,
],
'recipient_email' => [
'description' => 'The recipient of the email',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
],
'subject' => [
'description' => 'The subject of the email',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
],
],
'primary key' => [
'lid',
],
];
return $schema;
}
/**
* Creates the {development_environment_log} table in the database.
*/
function development_environment_update_8001() {
Database::getConnection()
->schema()
->createTable('development_environment_log', [
'description' => 'Email logs stored by the development environment module',
'fields' => [
'lid' => [
'description' => 'The unique Log ID of the log item',
'type' => 'serial',
'not null' => TRUE,
],
'email_data' => [
'description' => 'The Drupal email data',
'type' => 'text',
'not null' => TRUE,
],
'timestamp' => [
'description' => 'The UNIX timestamp at which the email was logged',
'type' => 'int',
'length' => 10,
'not null' => TRUE,
'unsigned' => TRUE,
],
'recipient_email' => [
'description' => 'The recipient of the email',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
],
'subject' => [
'description' => 'The subject of the email',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
],
],
'primary key' => [
'lid',
],
]);
}
Functions
Name | Description |
---|---|
development_environment_schema | Implements hook_schema(). |
development_environment_update_8001 | Creates the {development_environment_log} table in the database. |