1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Bdf\Prime\Schema\Builder; |
4
|
|
|
|
5
|
|
|
use Bdf\Prime\Platform\PlatformTypeInterface; |
6
|
|
|
use Bdf\Prime\Platform\PlatformTypesInterface; |
7
|
|
|
use Bdf\Prime\Schema\IndexInterface; |
8
|
|
|
use Bdf\Prime\Types\TypeInterface; |
9
|
|
|
use Bdf\Prime\Types\TypesHelperInterface; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Decorate TableBuilder for adding extra helper methods for adding types |
13
|
|
|
* Not like table builder, all helpers method will return $this |
14
|
|
|
* All those methods can be chained. |
15
|
|
|
* |
16
|
|
|
* The given type registry must be a @see PlatformTypesInterface for resolve "complex" types like bigint, or array |
|
|
|
|
17
|
|
|
* |
18
|
|
|
* <code> |
19
|
|
|
* $builder |
20
|
|
|
* ->bigint('id')->autoincrement()->primary() |
21
|
|
|
* ->string('first_name', 32)->nillable()->unique('idx_name') |
22
|
|
|
* ->string('last_name', 32)->nillable()->unique('idx_name') |
23
|
|
|
* ; |
24
|
|
|
* </code> |
25
|
|
|
*/ |
26
|
|
|
final class TypesHelperTableBuilder implements TableBuilderInterface, TypesHelperInterface |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @var TableBuilderInterface |
30
|
|
|
*/ |
31
|
|
|
private $builder; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var PlatformTypesInterface |
35
|
|
|
*/ |
36
|
|
|
private $types; |
37
|
|
|
|
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* TypesHelperTableBuilder constructor. |
41
|
|
|
* |
42
|
|
|
* @param TableBuilderInterface $builder |
43
|
|
|
* @param PlatformTypesInterface $types |
44
|
|
|
*/ |
45
|
249 |
|
public function __construct(TableBuilderInterface $builder, PlatformTypesInterface $types) |
|
|
|
|
46
|
|
|
{ |
47
|
249 |
|
$this->builder = $builder; |
48
|
249 |
|
$this->types = $types; |
49
|
249 |
|
} |
50
|
|
|
|
51
|
|
|
//===================// |
|
|
|
|
52
|
|
|
// Delegated methods // |
53
|
|
|
//===================// |
|
|
|
|
54
|
|
|
|
55
|
|
|
/** |
|
|
|
|
56
|
|
|
* {@inheritdoc} |
57
|
|
|
*/ |
58
|
1 |
|
public function name($name) |
59
|
|
|
{ |
60
|
1 |
|
$this->builder->name($name); |
61
|
|
|
|
62
|
1 |
|
return $this; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
|
|
|
|
66
|
|
|
* {@inheritdoc} |
67
|
|
|
*/ |
68
|
1 |
|
public function options(array $options) |
69
|
|
|
{ |
70
|
1 |
|
$this->builder->options($options); |
71
|
|
|
|
72
|
1 |
|
return $this; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
|
|
|
|
76
|
|
|
* {@inheritdoc} |
77
|
|
|
*/ |
78
|
1 |
|
public function indexes(array $indexes) |
79
|
|
|
{ |
80
|
1 |
|
$this->builder->indexes($indexes); |
81
|
|
|
|
82
|
1 |
|
return $this; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
|
|
|
|
86
|
|
|
* {@inheritdoc} |
87
|
|
|
*/ |
88
|
157 |
|
public function primary($columns = null, $name = null) |
89
|
|
|
{ |
90
|
157 |
|
$this->builder->primary($columns, $name); |
91
|
|
|
|
92
|
157 |
|
return $this; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
|
|
|
|
96
|
|
|
* {@inheritdoc} |
97
|
|
|
*/ |
98
|
241 |
|
public function add($column, PlatformTypeInterface $type, array $options = []) |
99
|
|
|
{ |
100
|
241 |
|
return $this->builder->add($column, $type, $options); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
|
|
|
|
104
|
|
|
* {@inheritdoc} |
105
|
|
|
*/ |
106
|
198 |
|
public function column($name = null) |
107
|
|
|
{ |
108
|
198 |
|
return $this->builder->column($name); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
|
|
|
|
112
|
|
|
* {@inheritdoc} |
113
|
|
|
*/ |
114
|
1 |
|
public function foreignKey($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = [], $constraintName = null) |
115
|
|
|
{ |
116
|
1 |
|
$this->builder->foreignKey($foreignTable, $localColumnNames, $foreignColumnNames, $options, $constraintName); |
117
|
|
|
|
118
|
1 |
|
return $this; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
|
|
|
|
122
|
|
|
* {@inheritdoc} |
123
|
|
|
*/ |
124
|
1 |
|
public function index($columns, $type = IndexInterface::TYPE_SIMPLE, $name = null, array $options = []) |
125
|
|
|
{ |
126
|
1 |
|
$this->builder->index($columns, $type, $name, $options); |
127
|
|
|
|
128
|
1 |
|
return $this; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* {@inheritdoc} |
133
|
|
|
*/ |
134
|
212 |
|
public function build() |
135
|
|
|
{ |
136
|
212 |
|
return $this->builder->build(); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
//================// |
|
|
|
|
140
|
|
|
// Helper methods // |
141
|
|
|
//================// |
|
|
|
|
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* Add a new column with type as string |
145
|
|
|
* |
146
|
|
|
* @param string $column |
147
|
|
|
* @param string $type |
148
|
|
|
* @param array $options |
149
|
|
|
* |
150
|
|
|
* @return ColumnBuilderInterface |
151
|
|
|
* |
152
|
|
|
* @see TableBuilderInterface::add() |
153
|
|
|
*/ |
154
|
240 |
|
public function addTypeAsString($column, $type, array $options = []) |
155
|
|
|
{ |
156
|
240 |
|
return $this->add( |
157
|
240 |
|
$column, |
158
|
240 |
|
$this->types->native($type), |
159
|
240 |
|
$options |
160
|
|
|
); |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
|
|
|
|
164
|
|
|
* {@inheritdoc} |
165
|
|
|
*/ |
166
|
211 |
|
public function string($name, $length = 255, $default = null) |
167
|
|
|
{ |
168
|
211 |
|
$this->addTypeAsString($name, TypeInterface::STRING) |
169
|
211 |
|
->length($length) |
|
|
|
|
170
|
211 |
|
->setDefault($default) |
|
|
|
|
171
|
|
|
; |
|
|
|
|
172
|
|
|
|
173
|
211 |
|
return $this; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
|
|
|
|
177
|
|
|
* {@inheritdoc} |
178
|
|
|
*/ |
179
|
2 |
|
public function text($name, $default = null) |
180
|
|
|
{ |
181
|
2 |
|
$this->addTypeAsString($name, TypeInterface::TEXT)->setDefault($default); |
182
|
|
|
|
183
|
2 |
|
return $this; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
|
|
|
|
187
|
|
|
* {@inheritdoc} |
188
|
|
|
*/ |
189
|
24 |
|
public function integer($name, $default = null) |
190
|
|
|
{ |
191
|
24 |
|
$this->addTypeAsString($name, TypeInterface::INTEGER)->setDefault($default); |
192
|
|
|
|
193
|
24 |
|
return $this; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
|
|
|
|
197
|
|
|
* {@inheritdoc} |
198
|
|
|
*/ |
199
|
2 |
|
public function tinyint($name, $default = null) |
200
|
|
|
{ |
201
|
2 |
|
$this->addTypeAsString($name, TypeInterface::TINYINT)->setDefault($default); |
202
|
|
|
|
203
|
2 |
|
return $this; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
|
|
|
|
207
|
|
|
* {@inheritdoc} |
208
|
|
|
*/ |
209
|
2 |
|
public function smallint($name, $default = null) |
210
|
|
|
{ |
211
|
2 |
|
$this->addTypeAsString($name, TypeInterface::SMALLINT)->setDefault($default); |
212
|
|
|
|
213
|
2 |
|
return $this; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* Create a new medium integer (3-byte) column on the table. |
218
|
|
|
* |
219
|
|
|
* @param string $name |
|
|
|
|
220
|
|
|
* @param mixed $default |
|
|
|
|
221
|
|
|
* |
222
|
|
|
* @return $this |
223
|
|
|
*/ |
224
|
|
|
public function mediumint($name, $default = null) |
225
|
|
|
{ |
226
|
|
|
$this->addTypeAsString($name, 'mediumint')->setDefault($default); |
227
|
|
|
|
228
|
|
|
return $this; |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
|
|
|
|
232
|
|
|
* {@inheritdoc} |
233
|
|
|
*/ |
234
|
160 |
|
public function bigint($name, $default = null) |
235
|
|
|
{ |
236
|
160 |
|
$this->addTypeAsString($name, TypeInterface::BIGINT)->setDefault($default); |
237
|
|
|
|
238
|
160 |
|
return $this; |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
/** |
242
|
|
|
* Create a new unsigned tiny integer (1-byte) column on the table. |
243
|
|
|
* |
244
|
|
|
* @param string $name |
245
|
|
|
* @param mixed $default |
246
|
|
|
* |
247
|
|
|
* @return $this |
248
|
|
|
*/ |
249
|
1 |
|
public function unsignedTinyint($name, $default = null) |
250
|
|
|
{ |
251
|
1 |
|
return $this->tinyint($name, $default)->unsigned(); |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
/** |
255
|
|
|
* Create a new unsigned small integer (2-byte) column on the table. |
256
|
|
|
* |
257
|
|
|
* @param string $name |
258
|
|
|
* @param mixed $default |
259
|
|
|
* |
260
|
|
|
* @return $this |
261
|
|
|
*/ |
262
|
1 |
|
public function unsignedSmallint($name, $default = null) |
263
|
|
|
{ |
264
|
1 |
|
return $this->smallint($name, $default)->unsigned(); |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
/** |
268
|
|
|
* Create a new unsigned medium integer (3-byte) column on the table. |
269
|
|
|
* |
270
|
|
|
* @param string $name |
271
|
|
|
* @param mixed $default |
272
|
|
|
* |
273
|
|
|
* @return $this |
274
|
|
|
*/ |
275
|
|
|
public function unsignedMediumint($name, $default = null) |
276
|
|
|
{ |
277
|
|
|
return $this->mediumint($name, $default)->unsigned(); |
278
|
|
|
} |
279
|
|
|
|
280
|
|
|
/** |
281
|
|
|
* Create a new unsigned integer (4-byte) column on the table. |
282
|
|
|
* |
283
|
|
|
* @param string $name |
284
|
|
|
* @param mixed $default |
285
|
|
|
* |
286
|
|
|
* @return $this |
287
|
|
|
*/ |
288
|
1 |
|
public function unsignedInteger($name, $default = null) |
289
|
|
|
{ |
290
|
1 |
|
return $this->integer($name, $default)->unsigned(); |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
/** |
294
|
|
|
* Create a new unsigned big integer (8-byte) column on the table. |
295
|
|
|
* |
296
|
|
|
* @param string $name |
297
|
|
|
* @param mixed $default |
298
|
|
|
* |
299
|
|
|
* @return $this |
300
|
|
|
*/ |
301
|
1 |
|
public function unsignedBigint($name, $default = null) |
302
|
|
|
{ |
303
|
1 |
|
return $this->bigint($name, $default)->unsigned(); |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
/** |
|
|
|
|
307
|
|
|
* {@inheritdoc} |
308
|
|
|
*/ |
309
|
1 |
|
public function float($name, $default = null) |
310
|
|
|
{ |
311
|
1 |
|
$this->addTypeAsString($name, TypeInterface::FLOAT)->setDefault($default); |
312
|
|
|
|
313
|
1 |
|
return $this; |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
/** |
|
|
|
|
317
|
|
|
* {@inheritdoc} |
318
|
|
|
*/ |
319
|
1 |
|
public function double($name, $default = null) |
320
|
|
|
{ |
321
|
1 |
|
$this->addTypeAsString($name, TypeInterface::DOUBLE)->setDefault($default); |
322
|
|
|
|
323
|
1 |
|
return $this; |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
/** |
|
|
|
|
327
|
|
|
* {@inheritdoc} |
328
|
|
|
*/ |
329
|
|
|
public function decimal($name, $default = null) |
330
|
|
|
{ |
331
|
|
|
$this->addTypeAsString($name, TypeInterface::DECIMAL)->setDefault($default); |
332
|
|
|
|
333
|
|
|
return $this; |
334
|
|
|
} |
335
|
|
|
|
336
|
|
|
/** |
|
|
|
|
337
|
|
|
* {@inheritdoc} |
338
|
|
|
*/ |
339
|
3 |
|
public function boolean($name, $default = null) |
340
|
|
|
{ |
341
|
3 |
|
$this->addTypeAsString($name, TypeInterface::BOOLEAN)->setDefault($default); |
342
|
|
|
|
343
|
3 |
|
return $this; |
344
|
|
|
} |
345
|
|
|
|
346
|
|
|
/** |
347
|
|
|
* Create a new enum column on the table. |
348
|
|
|
* |
349
|
|
|
* @param string $name |
|
|
|
|
350
|
|
|
* @param array $allowed |
|
|
|
|
351
|
|
|
* |
352
|
|
|
* @return $this |
353
|
|
|
*/ |
354
|
|
|
// public function enum($name, array $allowed) |
|
|
|
|
355
|
|
|
// { |
|
|
|
|
356
|
|
|
// $this->addTypeAsString($name, 'enum', ['allowed' => $allowed]); |
|
|
|
|
357
|
|
|
// |
|
|
|
|
358
|
|
|
// return $this; |
|
|
|
|
359
|
|
|
// } |
|
|
|
|
360
|
|
|
|
361
|
|
|
/** |
|
|
|
|
362
|
|
|
* {@inheritdoc} |
363
|
|
|
*/ |
364
|
|
|
public function date($name, $default = null) |
365
|
|
|
{ |
366
|
|
|
$this->addTypeAsString($name, TypeInterface::DATE)->setDefault($default); |
367
|
|
|
|
368
|
|
|
return $this; |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
/** |
|
|
|
|
372
|
|
|
* {@inheritdoc} |
373
|
|
|
*/ |
374
|
111 |
|
public function dateTime($name, $default = null) |
375
|
|
|
{ |
376
|
111 |
|
$this->addTypeAsString($name, TypeInterface::DATETIME)->setDefault($default); |
377
|
|
|
|
378
|
111 |
|
return $this; |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
/** |
|
|
|
|
382
|
|
|
* {@inheritdoc} |
383
|
|
|
*/ |
384
|
|
|
public function dateTimeTz($name, $default = null) |
385
|
|
|
{ |
386
|
|
|
$this->addTypeAsString($name, TypeInterface::DATETIMETZ)->setDefault($default); |
387
|
|
|
|
388
|
|
|
return $this; |
389
|
|
|
} |
390
|
|
|
|
391
|
|
|
/** |
|
|
|
|
392
|
|
|
* {@inheritdoc} |
393
|
|
|
*/ |
394
|
|
|
public function time($name, $default = null) |
395
|
|
|
{ |
396
|
|
|
$this->addTypeAsString($name, TypeInterface::TIME)->setDefault($default); |
397
|
|
|
|
398
|
|
|
return $this; |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
/** |
|
|
|
|
402
|
|
|
* {@inheritdoc} |
403
|
|
|
*/ |
404
|
|
|
public function timestamp($name, $default = null) |
405
|
|
|
{ |
406
|
|
|
$this->addTypeAsString($name, TypeInterface::TIMESTAMP)->setDefault($default); |
407
|
|
|
|
408
|
|
|
return $this; |
409
|
|
|
} |
410
|
|
|
|
411
|
|
|
/** |
|
|
|
|
412
|
|
|
* {@inheritdoc} |
413
|
|
|
*/ |
414
|
1 |
|
public function binary($name, $default = null) |
415
|
|
|
{ |
416
|
1 |
|
$this->addTypeAsString($name, TypeInterface::BINARY)->setDefault($default); |
417
|
|
|
|
418
|
1 |
|
return $this; |
419
|
|
|
} |
420
|
|
|
|
421
|
|
|
/** |
|
|
|
|
422
|
|
|
* {@inheritdoc} |
423
|
|
|
*/ |
424
|
1 |
|
public function blob($name, $default = null) |
425
|
|
|
{ |
426
|
1 |
|
$this->addTypeAsString($name, TypeInterface::BLOB)->setDefault($default); |
427
|
|
|
|
428
|
1 |
|
return $this; |
429
|
|
|
} |
430
|
|
|
|
431
|
|
|
/** |
|
|
|
|
432
|
|
|
* {@inheritdoc} |
433
|
|
|
*/ |
434
|
|
|
public function guid($name, $default = null) |
435
|
|
|
{ |
436
|
|
|
$this->addTypeAsString($name, TypeInterface::GUID)->setDefault($default); |
437
|
|
|
|
438
|
|
|
return $this; |
439
|
|
|
} |
440
|
|
|
|
441
|
|
|
/** |
442
|
|
|
* Create a new json column on the table. |
443
|
|
|
* |
444
|
|
|
* @param string $name |
|
|
|
|
445
|
|
|
* @param mixed $default |
|
|
|
|
446
|
|
|
* |
447
|
|
|
* @return $this |
448
|
|
|
*/ |
449
|
1 |
|
public function json($name, $default = null) |
450
|
|
|
{ |
451
|
1 |
|
$this->addTypeAsString($name, TypeInterface::JSON)->setDefault($default); |
452
|
|
|
|
453
|
1 |
|
return $this; |
454
|
|
|
} |
455
|
|
|
|
456
|
|
|
/** |
|
|
|
|
457
|
|
|
* {@inheritdoc} |
458
|
|
|
*/ |
459
|
1 |
|
public function simpleArray($name, $default = null) |
460
|
|
|
{ |
461
|
1 |
|
$this->addTypeAsString($name, TypeInterface::TARRAY)->setDefault($default); |
462
|
|
|
|
463
|
1 |
|
return $this; |
464
|
|
|
} |
465
|
|
|
|
466
|
|
|
/** |
|
|
|
|
467
|
|
|
* {@inheritdoc} |
468
|
|
|
*/ |
469
|
1 |
|
public function object($name, $default = null) |
470
|
|
|
{ |
471
|
1 |
|
$this->addTypeAsString($name, TypeInterface::OBJECT)->setDefault($default); |
472
|
|
|
|
473
|
1 |
|
return $this; |
474
|
|
|
} |
475
|
|
|
|
476
|
|
|
/** |
|
|
|
|
477
|
|
|
* {@inheritdoc} |
478
|
|
|
*/ |
479
|
1 |
|
public function arrayObject($name, $default = null) |
480
|
|
|
{ |
481
|
1 |
|
$this->addTypeAsString($name, TypeInterface::ARRAY_OBJECT)->setDefault($default); |
482
|
|
|
|
483
|
1 |
|
return $this; |
484
|
|
|
} |
485
|
|
|
|
486
|
|
|
/** |
|
|
|
|
487
|
|
|
* {@inheritdoc} |
488
|
|
|
*/ |
489
|
1 |
|
public function searchableArray($name, $default = null) |
490
|
|
|
{ |
491
|
1 |
|
$this->addTypeAsString($name, TypeInterface::TARRAY)->setDefault($default); |
492
|
|
|
|
493
|
1 |
|
return $this; |
494
|
|
|
} |
495
|
|
|
|
496
|
|
|
/** |
|
|
|
|
497
|
|
|
* {@inheritdoc} |
498
|
|
|
*/ |
499
|
4 |
|
public function arrayOf($name, $type, $default = null) |
500
|
|
|
{ |
501
|
4 |
|
$this->addTypeAsString($name, $type.'[]')->setDefault($default); |
502
|
|
|
|
503
|
4 |
|
return $this; |
504
|
|
|
} |
505
|
|
|
|
506
|
|
|
/** |
|
|
|
|
507
|
|
|
* {@inheritdoc} |
508
|
|
|
*/ |
509
|
1 |
|
public function arrayOfInt($name, $default = null) |
510
|
|
|
{ |
511
|
1 |
|
return $this->arrayOf($name, TypeInterface::INTEGER, $default); |
512
|
|
|
} |
513
|
|
|
|
514
|
|
|
/** |
|
|
|
|
515
|
|
|
* {@inheritdoc} |
516
|
|
|
*/ |
517
|
1 |
|
public function arrayOfDouble($name, $default = null) |
518
|
|
|
{ |
519
|
1 |
|
return $this->arrayOf($name, TypeInterface::DOUBLE, $default); |
520
|
|
|
} |
521
|
|
|
|
522
|
|
|
/** |
|
|
|
|
523
|
|
|
* {@inheritdoc} |
524
|
|
|
*/ |
525
|
1 |
|
public function arrayOfDateTime($name, $default = null) |
526
|
|
|
{ |
527
|
1 |
|
return $this->arrayOf($name, TypeInterface::DATETIME, $default); |
528
|
|
|
} |
529
|
|
|
|
530
|
|
|
/** |
531
|
|
|
* Specify the autoincrement key. |
532
|
|
|
* /!\ Unlike FieldBuilder, this method will not set the column as primary key |
533
|
|
|
* |
534
|
|
|
* @param bool $flag Activate/Deactivate autoincrement |
|
|
|
|
535
|
|
|
* |
536
|
|
|
* @return $this |
537
|
|
|
* |
538
|
|
|
* @see ColumnBuilderInterface::autoincrement() |
539
|
|
|
*/ |
540
|
137 |
|
public function autoincrement($flag = true) |
541
|
|
|
{ |
542
|
137 |
|
$this->column()->autoincrement($flag); |
543
|
|
|
|
544
|
137 |
|
return $this; |
545
|
|
|
} |
546
|
|
|
|
547
|
|
|
/** |
548
|
|
|
* Set nillable flag of current field |
549
|
|
|
* |
550
|
|
|
* @param bool $flag Activate/Deactivate nillable |
|
|
|
|
551
|
|
|
* |
552
|
|
|
* @return $this This builder instance |
553
|
|
|
*/ |
554
|
136 |
|
public function nillable($flag = true) |
555
|
|
|
{ |
556
|
136 |
|
$this->column()->nillable($flag); |
557
|
|
|
|
558
|
136 |
|
return $this; |
559
|
|
|
} |
560
|
|
|
|
561
|
|
|
/** |
562
|
|
|
* Set unsigned flag on the current field |
563
|
|
|
* |
564
|
|
|
* @param bool $flag Activate/Deactivate unsigned |
|
|
|
|
565
|
|
|
* |
566
|
|
|
* @return $this This builder instance |
567
|
|
|
*/ |
568
|
8 |
|
public function unsigned($flag = true) |
569
|
|
|
{ |
570
|
8 |
|
$this->column()->unsigned($flag); |
571
|
|
|
|
572
|
8 |
|
return $this; |
573
|
|
|
} |
574
|
|
|
|
575
|
|
|
/** |
576
|
|
|
* Define the decimal field precision |
577
|
|
|
* |
578
|
|
|
* @param int $precision The number of significant digits that are stored for values |
|
|
|
|
579
|
|
|
* @param int $scale The number of digits that can be stored following the decimal point |
|
|
|
|
580
|
|
|
* |
581
|
|
|
* @return $this This builder instance |
582
|
|
|
*/ |
583
|
2 |
|
public function precision(int $precision, int $scale) |
584
|
|
|
{ |
585
|
2 |
|
$this->column()->precision($precision, $scale); |
586
|
|
|
|
587
|
2 |
|
return $this; |
588
|
|
|
} |
589
|
|
|
} |
590
|
|
|
|