-
Notifications
You must be signed in to change notification settings - Fork 503
/
20180512214359_create_form_attribute_hxl_attribute_tag_table.php
38 lines (36 loc) · 1.53 KB
/
20180512214359_create_form_attribute_hxl_attribute_tag_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
<?php
use Phinx\Migration\AbstractMigration;
class CreateFormAttributeHxlAttributeTagTable extends AbstractMigration
{
public function up()
{
$this->table('form_attribute_hxl_attribute_tag')
->addColumn('form_attribute_id', 'integer', [
'null' => false,
'default' => false
])
->addColumn('hxl_attribute_id', 'integer', [
'null' => true,
'default' => null
])
->addColumn('hxl_tag_id', 'integer', [
'null' => false,
'default' => false
])
->addColumn('export_job_id', 'integer', [
'null' => false,
'default' => false
])
->addForeignKey('form_attribute_id', 'form_attributes', 'id', ['delete'=>'CASCADE', 'update'=>'CASCADE'])
->addForeignKey('hxl_attribute_id', 'hxl_attributes', 'id', ['delete'=>'CASCADE', 'update'=>'CASCADE'])
->addForeignKey('hxl_tag_id', 'hxl_tags', 'id', ['delete'=>'CASCADE', 'update'=>'CASCADE'])
->addForeignKey('export_job_id', 'export_job', 'id', ['delete'=>'CASCADE', 'update'=>'CASCADE'])
// ->setOptions(['comment' => 'The link between the form attributes and tags assigned to an export job.
// This lets us set the hxl header correctly and search for the assigned values'])
->create();
}
public function down()
{
$this->table('form_attribute_hxl_attribute_tag')->drop()->save();
}
}