1 | <?php |
||
35 | trait SchemaBuilderTrait |
||
36 | { |
||
37 | /** |
||
38 | * @return Connection the database connection to be used for schema building. |
||
39 | */ |
||
40 | abstract protected function getDb(); |
||
41 | |||
42 | /** |
||
43 | * Creates a primary key column. |
||
44 | * @param int $length column size or precision definition. |
||
45 | * This parameter will be ignored if not supported by the DBMS. |
||
46 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
47 | * @since 2.0.6 |
||
48 | */ |
||
49 | 6 | public function primaryKey($length = null) |
|
53 | |||
54 | /** |
||
55 | * Creates a big primary key column. |
||
56 | * @param int $length column size or precision definition. |
||
57 | * This parameter will be ignored if not supported by the DBMS. |
||
58 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
59 | * @since 2.0.6 |
||
60 | */ |
||
61 | 12 | public function bigPrimaryKey($length = null) |
|
65 | |||
66 | /** |
||
67 | * Creates a char column. |
||
68 | * @param int $length column size definition i.e. the maximum string length. |
||
69 | * This parameter will be ignored if not supported by the DBMS. |
||
70 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
71 | * @since 2.0.8 |
||
72 | */ |
||
73 | 6 | public function char($length = null) |
|
77 | |||
78 | /** |
||
79 | * Creates a string column. |
||
80 | * @param int $length column size definition i.e. the maximum string length. |
||
81 | * This parameter will be ignored if not supported by the DBMS. |
||
82 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
83 | * @since 2.0.6 |
||
84 | */ |
||
85 | 33 | public function string($length = null) |
|
89 | |||
90 | /** |
||
91 | * Creates a text column. |
||
92 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
93 | * @since 2.0.6 |
||
94 | */ |
||
95 | 12 | public function text() |
|
99 | |||
100 | /** |
||
101 | * Creates a tinyint column. If tinyint is not supported by the DBMS, smallint will be used. |
||
102 | * @param int $length column size or precision definition. |
||
103 | * This parameter will be ignored if not supported by the DBMS. |
||
104 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
105 | * @since 2.0.14 |
||
106 | */ |
||
107 | 6 | public function tinyInteger($length = null) |
|
111 | |||
112 | /** |
||
113 | * Creates a smallint column. |
||
114 | * @param int $length column size or precision definition. |
||
115 | * This parameter will be ignored if not supported by the DBMS. |
||
116 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
117 | * @since 2.0.6 |
||
118 | */ |
||
119 | 6 | public function smallInteger($length = null) |
|
123 | |||
124 | /** |
||
125 | * Creates an integer column. |
||
126 | * @param int $length column size or precision definition. |
||
127 | * This parameter will be ignored if not supported by the DBMS. |
||
128 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
129 | * @since 2.0.6 |
||
130 | */ |
||
131 | 33 | public function integer($length = null) |
|
135 | |||
136 | /** |
||
137 | * Creates a bigint column. |
||
138 | * @param int $length column size or precision definition. |
||
139 | * This parameter will be ignored if not supported by the DBMS. |
||
140 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
141 | * @since 2.0.6 |
||
142 | */ |
||
143 | 6 | public function bigInteger($length = null) |
|
147 | |||
148 | /** |
||
149 | * Creates a float column. |
||
150 | * @param int $precision column value precision. First parameter passed to the column type, e.g. FLOAT(precision). |
||
151 | * This parameter will be ignored if not supported by the DBMS. |
||
152 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
153 | * @since 2.0.6 |
||
154 | */ |
||
155 | 6 | public function float($precision = null) |
|
159 | |||
160 | /** |
||
161 | * Creates a double column. |
||
162 | * @param int $precision column value precision. First parameter passed to the column type, e.g. DOUBLE(precision). |
||
163 | * This parameter will be ignored if not supported by the DBMS. |
||
164 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
165 | * @since 2.0.6 |
||
166 | */ |
||
167 | 12 | public function double($precision = null) |
|
171 | |||
172 | /** |
||
173 | * Creates a decimal column. |
||
174 | * @param int $precision column value precision, which is usually the total number of digits. |
||
175 | * First parameter passed to the column type, e.g. DECIMAL(precision, scale). |
||
176 | * This parameter will be ignored if not supported by the DBMS. |
||
177 | * @param int $scale column value scale, which is usually the number of digits after the decimal point. |
||
178 | * Second parameter passed to the column type, e.g. DECIMAL(precision, scale). |
||
179 | * This parameter will be ignored if not supported by the DBMS. |
||
180 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
181 | * @since 2.0.6 |
||
182 | */ |
||
183 | 6 | public function decimal($precision = null, $scale = null) |
|
195 | |||
196 | /** |
||
197 | * Creates a datetime column. |
||
198 | * @param int $precision column value precision. First parameter passed to the column type, e.g. DATETIME(precision). |
||
199 | * This parameter will be ignored if not supported by the DBMS. |
||
200 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
201 | * @since 2.0.6 |
||
202 | */ |
||
203 | 6 | public function dateTime($precision = null) |
|
207 | |||
208 | /** |
||
209 | * Creates a timestamp column. |
||
210 | * @param int $precision column value precision. First parameter passed to the column type, e.g. TIMESTAMP(precision). |
||
211 | * This parameter will be ignored if not supported by the DBMS. |
||
212 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
213 | * @since 2.0.6 |
||
214 | */ |
||
215 | 6 | public function timestamp($precision = null) |
|
219 | |||
220 | /** |
||
221 | * Creates a time column. |
||
222 | * @param int $precision column value precision. First parameter passed to the column type, e.g. TIME(precision). |
||
223 | * This parameter will be ignored if not supported by the DBMS. |
||
224 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
225 | * @since 2.0.6 |
||
226 | */ |
||
227 | 6 | public function time($precision = null) |
|
231 | |||
232 | /** |
||
233 | * Creates a date column. |
||
234 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
235 | * @since 2.0.6 |
||
236 | */ |
||
237 | 6 | public function date() |
|
241 | |||
242 | /** |
||
243 | * Creates a binary column. |
||
244 | * @param int $length column size or precision definition. |
||
245 | * This parameter will be ignored if not supported by the DBMS. |
||
246 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
247 | * @since 2.0.6 |
||
248 | */ |
||
249 | 27 | public function binary($length = null) |
|
253 | |||
254 | /** |
||
255 | * Creates a boolean column. |
||
256 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
257 | * @since 2.0.6 |
||
258 | */ |
||
259 | 6 | public function boolean() |
|
263 | |||
264 | /** |
||
265 | * Creates a money column. |
||
266 | * @param int $precision column value precision, which is usually the total number of digits. |
||
267 | * First parameter passed to the column type, e.g. DECIMAL(precision, scale). |
||
268 | * This parameter will be ignored if not supported by the DBMS. |
||
269 | * @param int $scale column value scale, which is usually the number of digits after the decimal point. |
||
270 | * Second parameter passed to the column type, e.g. DECIMAL(precision, scale). |
||
271 | * This parameter will be ignored if not supported by the DBMS. |
||
272 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
273 | * @since 2.0.6 |
||
274 | */ |
||
275 | 6 | public function money($precision = null, $scale = null) |
|
287 | |||
288 | /** |
||
289 | * Creates a JSON column. |
||
290 | * @return ColumnSchemaBuilder the column instance which can be further customized. |
||
291 | * @since 2.0.14 |
||
292 | * @throws \yii\base\Exception |
||
293 | */ |
||
294 | 4 | public function json() |
|
308 | } |
||
309 |