dcat-8.x-1.x-dev/dcat_import/dcat_import.install
dcat_import/dcat_import.install
<?php
/**
* @file
* Install, update and uninstall functions for the dcat_import module.
*/
use Drupal\Core\Database\Database;
/**
* Implements hook_schema().
*/
function dcat_import_schema() {
$schema['dcat_import_log'] = [
'description' => 'Stores dcat import log messages',
'fields' => [
'id' => [
'description' => 'Primary key.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
'import_start' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Unix timestamp of when the import started.',
],
'source' => [
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Dcat source id.',
],
'migration' => [
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Drupal migration id.',
],
'type' => [
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'The message type',
],
'message' => [
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
'description' => 'Log message.',
],
],
'primary key' => ['id'],
'indexes' => [
'import_start' => ['import_start'],
'migration' => ['migration'],
],
];
return $schema;
}
/**
* Add log table.
*/
function dcat_import_update_8001() {
$schema = dcat_import_schema();
Database::getConnection()->schema()->createTable('dcat_import_log', $schema['dcat_import_log']);
}
