Installation

Le fichier mymodule/mymodule.install contient 4 hooks exécuté lorsque le module est installé ou désinstallé.

mymodule/mymodule.install
<?php
 
function mymodule_schema() {
 
  $schema['table1'] = [
    'description' => 'Description de la table 1',
    'fields' => [
      'id' => [
        'description' => 'ID',
        'type'        => 'serial',
        'unsigned'    => True,
        'not null'    => True,
      ],
      ...
      ...
    ],
    'primary key' => ['id'],
    'indexes' => [
      'index1' => ['champ1', 'champ2'],
      'index2' => [...],
    ],
  ];
 
  $schema['table2'] = [
    ...
    ...
    ...
  ];
 
  return $schema;
}