1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Migratio\GrammarStructure\Mysql\Wizard; |
4
|
|
|
|
5
|
|
|
use Migratio\Contract\NameContract; |
6
|
|
|
use Migratio\Contract\IndexContract; |
7
|
|
|
use Migratio\Contract\UniqueContract; |
8
|
|
|
use Migratio\Contract\WizardAlterContract; |
9
|
|
|
use Migratio\Contract\WizardAlterGroupContract; |
10
|
|
|
|
11
|
|
|
class WizardAlterGroup extends Wizard implements WizardAlterGroupContract |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @var array |
15
|
|
|
*/ |
16
|
|
|
protected $alterBinds = array(); |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* add column |
20
|
|
|
* |
21
|
|
|
* @return WizardAlterContract |
22
|
|
|
*/ |
23
|
|
|
public function addColumn() |
24
|
|
|
{ |
25
|
|
|
$this->alterBinds[] = __FUNCTION__; |
26
|
|
|
return $this->getWizardAlterInstance(__FUNCTION__); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* add column |
31
|
|
|
* |
32
|
|
|
* @return IndexContract |
33
|
|
|
*/ |
34
|
|
|
public function addIndex() |
35
|
|
|
{ |
36
|
|
|
$this->alterBinds[] = __FUNCTION__; |
37
|
|
|
return $this->addIndexWizardAlterInstance(__FUNCTION__); |
|
|
|
|
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* add column |
42
|
|
|
* |
43
|
|
|
* @return UniqueContract |
44
|
|
|
*/ |
45
|
|
|
public function addUnique() |
46
|
|
|
{ |
47
|
|
|
$this->alterBinds[] = __FUNCTION__; |
48
|
|
|
return $this->addUniqueWizardAlterInstance(__FUNCTION__); |
|
|
|
|
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* drop column |
53
|
|
|
* |
54
|
|
|
* @return NameContract |
55
|
|
|
*/ |
56
|
|
|
public function dropColumn() |
57
|
|
|
{ |
58
|
|
|
$this->alterBinds[] = __FUNCTION__; |
59
|
|
|
return $this->dropWizardAlterInstance(__FUNCTION__); |
|
|
|
|
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* change column |
64
|
|
|
* |
65
|
|
|
* @return WizardAlterContract |
66
|
|
|
*/ |
67
|
|
|
public function change() |
68
|
|
|
{ |
69
|
|
|
$this->alterBinds[] = __FUNCTION__; |
70
|
|
|
return $this->getWizardAlterInstance(__FUNCTION__); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* get wizard alter instance |
75
|
|
|
* |
76
|
|
|
* @param $group |
77
|
|
|
* @return WizardAlter |
78
|
|
|
*/ |
79
|
|
|
private function getWizardAlterInstance($group) |
80
|
|
|
{ |
81
|
|
|
$this->setAlterType('group',$group); |
82
|
|
|
|
83
|
|
|
return new WizardAlter($this); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @param $group |
88
|
|
|
* @return $this |
89
|
|
|
*/ |
90
|
|
|
private function dropWizardAlterInstance($group) |
91
|
|
|
{ |
92
|
|
|
$this->setAlterType('group',$group); |
93
|
|
|
|
94
|
|
|
return $this; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @param $group |
99
|
|
|
* @return $this |
100
|
|
|
*/ |
101
|
|
|
private function addIndexWizardAlterInstance($group) |
102
|
|
|
{ |
103
|
|
|
$this->setAlterType('group',$group); |
104
|
|
|
|
105
|
|
|
return $this; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @param $group |
110
|
|
|
* @return $this |
111
|
|
|
*/ |
112
|
|
|
private function addUniqueWizardAlterInstance($group) |
113
|
|
|
{ |
114
|
|
|
$this->setAlterType('group',$group); |
115
|
|
|
|
116
|
|
|
return $this; |
117
|
|
|
} |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
|