-
Notifications
You must be signed in to change notification settings - Fork 0
/
backup_db.install
executable file
·76 lines (70 loc) · 1.7 KB
/
backup_db.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* @file
* backup_db.install
*/
/**
* Implements hook_requirements().
*/
function backup_db_requirements($phase) {
$requirements = [];
if ($phase == 'install') {
if (!class_exists('\Ifsnop\Mysqldump\Mysqldump')) {
$requirements['backup_db_mysqldump'] = [
'description' => t('Backup Database requires the Ifsnop\Mysqldump library, please read the readme.md and install via composer.'),
'severity' => REQUIREMENT_ERROR,
];
}
}
return $requirements;
}
/**
* Implements hook_schema().
*/
function backup_db_schema() {
$schema['backup_db'] = [
'description' => 'Tracks export creation and location.',
'fields' => [
'eid' => [
'description' => 'The export identifier.',
'type' => 'serial',
'not null' => TRUE,
],
'fid' => [
'description' => 'The referenced file id.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'name' => [
'description' => 'The name of the export.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
],
'uri' => [
'description' => 'The uri of the export.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
],
'created' => [
'description' => 'The timestamp when the export was created.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
],
],
'primary key' => ['eid'],
'foreign keys' => [
'file' => [
'table' => 'file_managed',
'columns' => ['fid' => 'fid'],
],
],
];
return $schema;
}