9
9
| table | string | Name of table to create |
10
10
| fn | Function | Function containing blueprint object |
11
11
12
- ``` ts
12
+ ``` typescript
13
13
await Schema .createTable (' users' , (blueprint ) =>
14
14
{
15
15
blueprint .integer (' id' , {allowNull: false , length: 15 , signed: false });
@@ -23,7 +23,7 @@ await Schema.createTable('users', (blueprint) =>
23
23
| --------- | -------- | --------------------- |
24
24
| table | string | Name of table to drop |
25
25
26
- ``` ts
26
+ ``` typescript
27
27
await Schema .drop (' users' );
28
28
```
29
29
@@ -33,7 +33,7 @@ await Schema.drop('users');
33
33
| --------- | -------- | ---------------------------------- |
34
34
| table | string | Name of table to drop if it exists |
35
35
36
- ``` ts
36
+ ``` typescript
37
37
await Schema .dropIfExists (' users' );
38
38
```
39
39
@@ -44,7 +44,7 @@ await Schema.dropIfExists('users');
44
44
| table | string | Name of table |
45
45
| column | string | Name of column |
46
46
47
- ``` ts
47
+ ``` typescript
48
48
await Schema .hasColumn (' users' , ' id' );
49
49
```
50
50
@@ -54,20 +54,20 @@ await Schema.hasColumn('users', 'id');
54
54
| --------- | -------- | ------------- |
55
55
| table | string | Name of table |
56
56
57
- ``` ts
57
+ ``` typescript
58
58
await Schema .hasTable (' users' );
59
59
```
60
60
61
61
## Blueprint
62
62
63
63
#### bigInteger
64
64
65
- | Parameter | Type | Description |
66
- | --------- | -------- | -------------- |
67
- | name | string | Column name |
68
- | options | object | Column options |
65
+ | Parameter | Type | Description |
66
+ | --------- | -------------------- | -------------- |
67
+ | name | string | Column name |
68
+ | options | IntegerColumnOptions | Column options |
69
69
70
- ``` ts
70
+ ``` typescript
71
71
blueprint .bigInteger (' id' , {allowNull: false , length: 15 , signed: false });
72
72
```
73
73
@@ -77,43 +77,70 @@ blueprint.bigInteger('id', {allowNull: false, length: 15, signed: false});
77
77
| --------- | -------- | ----------- |
78
78
| name | string | Column name |
79
79
80
- ``` ts
80
+ ``` typescript
81
81
blueprint .blob (' binaryData' );
82
82
```
83
83
84
84
#### char
85
85
86
- ``` ts
86
+ | Parameter | Type | Description |
87
+ | --------- | -------- | ----------- |
88
+ | name | string | Column name |
89
+
90
+ ``` typescript
87
91
blueprint .char (' char' );
88
92
```
89
93
90
94
#### date
91
95
92
- ``` ts
96
+ | Parameter | Type | Description |
97
+ | --------- | -------- | ----------- |
98
+ | name | string | Column name |
99
+
100
+ ``` typescript
93
101
blueprint .date (' startDate' );
94
102
```
95
103
96
104
#### dateTime
97
105
98
- ``` ts
106
+ | Parameter | Type | Description |
107
+ | --------- | -------- | ----------- |
108
+ | name | string | Column name |
109
+
110
+ ``` typescript
99
111
blueprint .dateTime (' startDateTime' );
100
112
```
101
113
102
114
#### decimal
103
115
104
- ``` ts
116
+ | Parameter | Type | Description |
117
+ | --------- | ------------- | -------------- |
118
+ | name | string | Column name |
119
+ | options | ColumnOptions | Column options |
120
+
121
+ ``` typescript
105
122
blueprint .decimal (' decimalColumn' , {allowNull: false });
106
123
```
107
124
108
125
#### double
109
126
110
- ``` ts
127
+ | Parameter | Type | Description |
128
+ | --------- | ------------- | -------------- |
129
+ | name | string | Column name |
130
+ | options | ColumnOptions | Column options |
131
+
132
+ ``` typescript
111
133
blueprint .double (' numberColumn' , {length: 15 });
112
134
```
113
135
114
136
#### enum
115
137
116
- ``` ts
138
+ | Parameter | Type | Description |
139
+ | --------- | ----------------- | -------------- |
140
+ | name | string | Column name |
141
+ | options | EnumColumnOptions | Column options |
142
+
143
+ ``` typescript
117
144
blueprint .enum (' status' , {
118
145
values: [' pending' , ' succeeded' , ' failed' ],
119
146
defaultValue: null
@@ -122,72 +149,119 @@ blueprint.enum('status', {
122
149
123
150
#### float
124
151
125
- ``` ts
152
+ | Parameter | Type | Description |
153
+ | --------- | -------- | ----------- |
154
+ | name | string | Column name |
155
+
156
+ ``` typescript
126
157
blueprint .float (' floatColumn' );
127
158
```
128
159
129
160
#### integer
130
161
131
- ``` ts
162
+ ``` typescript
132
163
blueprint .integer (' id' , {length: 15 });
133
164
```
134
165
135
166
#### longText
136
167
137
- ``` ts
168
+ | Parameter | Type | Description |
169
+ | --------- | -------- | ----------- |
170
+ | name | string | Column name |
171
+
172
+ ``` typescript
138
173
blueprint .longText (' description' );
139
174
```
140
175
141
176
#### mediumInteger
142
177
143
- ``` ts
178
+ | Parameter | Type | Description |
179
+ | --------- | -------------------- | -------------- |
180
+ | name | string | Column name |
181
+ | options | IntegerColumnOptions | Column options |
182
+
183
+ ``` typescript
144
184
blueprint .mediumInteger (' id' );
145
185
```
146
186
147
187
#### mediumText
148
188
149
- ``` ts
189
+ | Parameter | Type | Description |
190
+ | --------- | -------- | ----------- |
191
+ | name | string | Column name |
192
+
193
+ ``` typescript
150
194
blueprint .mediumText (' shortDescription' );
151
195
```
152
196
153
197
#### smallInteger
154
198
155
- ``` ts
199
+ | Parameter | Type | Description |
200
+ | --------- | -------------------- | -------------- |
201
+ | name | string | Column name |
202
+ | options | IntegerColumnOptions | Column options |
203
+
204
+ ``` typescript
156
205
blueprint .smallInteger (' quantity' );
157
206
```
158
207
159
208
#### text
160
209
161
- ``` ts
210
+ | Parameter | Type | Description |
211
+ | --------- | -------- | ----------- |
212
+ | name | string | Column name |
213
+
214
+ ``` typescript
162
215
blueprint .text (' description' );
163
216
```
164
217
165
218
#### time
166
219
167
- ``` ts
220
+ | Parameter | Type | Description |
221
+ | --------- | -------- | ----------- |
222
+ | name | string | Column name |
223
+
224
+ ``` typescript
168
225
blueprint .time (' startTime' );
169
226
```
170
227
171
228
#### timestamp
172
229
173
- ``` ts
230
+ | Parameter | Type | Description |
231
+ | --------- | -------- | ----------- |
232
+ | name | string | Column name |
233
+
234
+ ``` typescript
174
235
blueprint .timestamp (' createdAt' );
175
236
```
176
237
177
238
#### tinyInteger
178
239
179
- ``` ts
240
+ | Parameter | Type | Description |
241
+ | --------- | -------------------- | -------------- |
242
+ | name | string | Column name |
243
+ | options | IntegerColumnOptions | Column options |
244
+
245
+ ``` typescript
180
246
blueprint .tinyInteger (' active' );
181
247
```
182
248
183
249
#### varchar
184
250
185
- ``` ts
251
+ | Parameter | Type | Description |
252
+ | --------- | -------- | ----------- |
253
+ | name | string | Column name |
254
+
255
+ ``` typescript
186
256
blueprint .varchar (' username' );
187
257
```
188
258
189
259
#### year
190
260
191
- ``` ts
261
+ | Parameter | Type | Description |
262
+ | --------- | -------- | ----------- |
263
+ | name | string | Column name |
264
+
265
+ ``` typescript
192
266
blueprint .year (' startYear' );
193
267
```
0 commit comments