You are here

we_megamenu.install in Drupal Mega Menu 8

Same filename and directory in other branches
  1. 8.x we_megamenu.install

Create table we_megamenu().

File

we_megamenu.install
View source
<?php

/**
 * @file
 * Create table we_megamenu().
 */

/**
 * Implements hook_schema().
 */
function we_megamenu_schema() {
  $schema['we_megamenu'] = [
    'fields' => [
      'menu_name' => [
        'type' => 'varchar',
        'length' => 150,
        'not null' => TRUE,
      ],
      'theme' => [
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
      ],
      'data_config' => [
        'type' => 'text',
        'not null' => FALSE,
        'size' => 'big',
      ],
    ],
    'primary key' => [
      'menu_name',
      'theme',
    ],
  ];
  return $schema;
}

/**
 * Implements hook_update().
 */
function we_megamenu_update_8101() {
  $sql = 'ALTER TABLE `we_megamenu` CHANGE `data_config` `data_config` LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL';
  \Drupal\Core\Database\Database::getConnection()
    ->query($sql);
}

Functions

Namesort descending Description
we_megamenu_schema Implements hook_schema().
we_megamenu_update_8101 Implements hook_update().