-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathBlueprint.php
More file actions
275 lines (249 loc) · 6.29 KB
/
Copy pathBlueprint.php
File metadata and controls
275 lines (249 loc) · 6.29 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<?php
namespace Bosnadev\Database\Schema;
/**
* Class Blueprint
* @package Bosnadev\Database\Schema
*/
class Blueprint extends \Illuminate\Database\Schema\Blueprint
{
/**
* Inherited table name
* @var string
*/
public $inherits;
/**
* Specify table inheritance.
*
* @param string $table
* @return void
*/
public function inherits($table)
{
$this->inherits = $table;
}
/**
* Add the index commands fluently specified on columns.
*
* @return void
*/
protected function addFluentIndexes()
{
foreach ($this->columns as $column) {
foreach (array('primary', 'unique', 'index', 'gin', 'gist') as $index) {
// If the index has been specified on the given column, but is simply
// equal to "true" (boolean), no name has been specified for this
// index, so we will simply call the index methods without one.
if ($column->$index === true) {
$this->$index($column->name);
continue 2;
}
// If the index has been specified on the column and it is something
// other than boolean true, we will assume a name was provided on
// the index specification, and pass in the name to the method.
elseif (isset($column->$index)) {
$this->$index($column->name, $column->$index);
continue 2;
}
}
}
}
/**
* Specify an index for the table.
*
* @param string|array $columns
* @param string $name
* @return \Illuminate\Support\Fluent
*/
public function gin($columns, $name = null)
{
return $this->indexCommand('gin', $columns, $name);
}
/**
* Specify a gist index for the table.
*
* @param string|array $columns
* @param string $name
* @return \Illuminate\Support\Fluent
*/
public function gist($columns, $name = null)
{
return $this->indexCommand('gist', $columns, $name);
}
/**
* Create a new character column on the table.
*
* @param string $column
* @param int $length
* @return \Illuminate\Support\Fluent
*/
public function character($column, $length = 255)
{
return $this->addColumn('character', $column, compact('length'));
}
/**
* @param $column
* @return \Illuminate\Support\Fluent
*/
public function hstore($column)
{
return $this->addColumn('hstore', $column);
}
/**
* Create a new netmask (CIDR-notation) (cidr) column on the table.
*
* @param string $column
* @return \Illuminate\Support\Fluent
*/
public function netmask($column)
{
return $this->addColumn('netmask', $column);
}
/**
* Create a new line column on the table.
*
* @param string $column
* @return \Illuminate\Support\Fluent
*/
public function line($column)
{
return $this->addColumn('line', $column);
}
/**
* Create a new line segment (lseg) column on the table.
*
* @param string $column
* @return \Illuminate\Support\Fluent
*/
public function lineSegment($column)
{
return $this->addColumn('lineSegment', $column);
}
/**
* Create a new path column on the table.
*
* @param string $column
* @return \Illuminate\Support\Fluent
*/
public function path($column)
{
return $this->addColumn('path', $column);
}
/**
* Create a new box column on the table.
*
* @param string $column
* @return \Illuminate\Support\Fluent
*/
public function box($column)
{
return $this->addColumn('box', $column);
}
/**
* Create a new circle column on the table.
*
* @param string $column
* @return \Illuminate\Support\Fluent
*/
public function circle($column)
{
return $this->addColumn('circle', $column);
}
/**
* Create a new money column on the table.
*
* @param string $column
* @return \Illuminate\Support\Fluent
*/
public function money($column)
{
return $this->addColumn('money', $column);
}
/**
* Create a new int4range column on the table.
*
* @param string $column
*
* @return \Illuminate\Support\Fluent
*/
public function int4range($column)
{
return $this->addColumn('int4range', $column);
}
/**
* Create a new int8range column on the table.
*
* @param string $column
*
* @return \Illuminate\Support\Fluent
*/
public function int8range($column)
{
return $this->addColumn('int8range', $column);
}
/**
* Create a new numrange column on the table.
*
* @param string $column
*
* @return \Illuminate\Support\Fluent
*/
public function numrange($column)
{
return $this->addColumn('numrange', $column);
}
/**
* Create a new tsrange column on the table.
*
* @param string $column
*
* @return \Illuminate\Support\Fluent
*/
public function tsrange($column)
{
return $this->addColumn('tsrange', $column);
}
/**
* Create a new tstzrange column on the table.
*
* @param string $column
*
* @return \Illuminate\Support\Fluent
*/
public function tstzrange($column)
{
return $this->addColumn('tstzrange', $column);
}
/**
* Create a new daterange column on the table.
*
* @param $column
*
* @return \Illuminate\Support\Fluent
*/
public function daterange($column)
{
return $this->addColumn('daterange', $column);
}
/**
* Create a new tsvector column on the table.
*
* @param $column
*
* @return \Illuminate\Support\Fluent
*/
public function tsvector($column)
{
return $this->addColumn('tsvector', $column);
}
/**
* Create a new citext column on the table.
*
* @param $column
*
* @return \Illuminate\Support\Fluent
*/
public function citext($column)
{
return $this->addColumn('citext', $column);
}
}