-
Notifications
You must be signed in to change notification settings - Fork 503
/
20180512175804_add_hxl_metadata_table.php
60 lines (57 loc) · 1.77 KB
/
20180512175804_add_hxl_metadata_table.php
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
<?php
use Phinx\Migration\AbstractMigration;
class AddHxlMetadataTable extends AbstractMigration
{
public function up()
{
$this->table('hxl_meta_data')
->addColumn('private', 'boolean', [
'default' => true,
'comment' => 'Is this a private dataset in HDX? ',
])
->addColumn('dataset_title', 'string', [
'null' => false,
'limit' => 255,
'comment' => 'Dataset title in HDX',
])
->addColumn('license_id', 'integer', [
'null' => false,
'comment' => 'Dataset license in HDX',
])
->addColumn('user_id', 'integer', [
'null' => false,
])
->addColumn('organisation', 'string', [
'null' => false,
'limit' => 255
])
->addColumn('source', 'string', [
'null' => false,
'limit' => 255
])
->addColumn('maintainer', 'string', [
'null' => false,
'limit' => 255
])
->addIndex('dataset_title')
->addColumn('created', 'integer', ['default' => 0])
->addColumn('updated', 'integer', ['null' => true])
->addForeignKey(
'user_id',
'users',
'id',
['delete'=>'CASCADE', 'update'=>'CASCADE']
)
->addForeignKey(
'license_id',
'hxl_license',
'id',
['delete'=>'CASCADE', 'update'=>'CASCADE']
)
->create();
}
public function down()
{
$this->table('hxl_meta_data')->drop()->save();
}
}