@@ -61,7 +61,7 @@ public function testBluePrint(): void
61
61
{
62
62
$ instance = $ this ;
63
63
64
- Schema::collection ('newcollection ' , function ($ collection ) use ($ instance ) {
64
+ Schema::table ('newcollection ' , function ($ collection ) use ($ instance ) {
65
65
$ instance ->assertInstanceOf (Blueprint::class, $ collection );
66
66
});
67
67
@@ -72,21 +72,21 @@ public function testBluePrint(): void
72
72
73
73
public function testIndex (): void
74
74
{
75
- Schema::collection ('newcollection ' , function ($ collection ) {
75
+ Schema::table ('newcollection ' , function ($ collection ) {
76
76
$ collection ->index ('mykey1 ' );
77
77
});
78
78
79
79
$ index = $ this ->getIndex ('newcollection ' , 'mykey1 ' );
80
80
$ this ->assertEquals (1 , $ index ['key ' ]['mykey1 ' ]);
81
81
82
- Schema::collection ('newcollection ' , function ($ collection ) {
82
+ Schema::table ('newcollection ' , function ($ collection ) {
83
83
$ collection ->index (['mykey2 ' ]);
84
84
});
85
85
86
86
$ index = $ this ->getIndex ('newcollection ' , 'mykey2 ' );
87
87
$ this ->assertEquals (1 , $ index ['key ' ]['mykey2 ' ]);
88
88
89
- Schema::collection ('newcollection ' , function ($ collection ) {
89
+ Schema::table ('newcollection ' , function ($ collection ) {
90
90
$ collection ->string ('mykey3 ' )->index ();
91
91
});
92
92
@@ -96,7 +96,7 @@ public function testIndex(): void
96
96
97
97
public function testPrimary (): void
98
98
{
99
- Schema::collection ('newcollection ' , function ($ collection ) {
99
+ Schema::table ('newcollection ' , function ($ collection ) {
100
100
$ collection ->string ('mykey ' , 100 )->primary ();
101
101
});
102
102
@@ -106,7 +106,7 @@ public function testPrimary(): void
106
106
107
107
public function testUnique (): void
108
108
{
109
- Schema::collection ('newcollection ' , function ($ collection ) {
109
+ Schema::table ('newcollection ' , function ($ collection ) {
110
110
$ collection ->unique ('uniquekey ' );
111
111
});
112
112
@@ -116,58 +116,58 @@ public function testUnique(): void
116
116
117
117
public function testDropIndex (): void
118
118
{
119
- Schema::collection ('newcollection ' , function ($ collection ) {
119
+ Schema::table ('newcollection ' , function ($ collection ) {
120
120
$ collection ->unique ('uniquekey ' );
121
121
$ collection ->dropIndex ('uniquekey_1 ' );
122
122
});
123
123
124
124
$ index = $ this ->getIndex ('newcollection ' , 'uniquekey ' );
125
125
$ this ->assertEquals (null , $ index );
126
126
127
- Schema::collection ('newcollection ' , function ($ collection ) {
127
+ Schema::table ('newcollection ' , function ($ collection ) {
128
128
$ collection ->unique ('uniquekey ' );
129
129
$ collection ->dropIndex (['uniquekey ' ]);
130
130
});
131
131
132
132
$ index = $ this ->getIndex ('newcollection ' , 'uniquekey ' );
133
133
$ this ->assertEquals (null , $ index );
134
134
135
- Schema::collection ('newcollection ' , function ($ collection ) {
135
+ Schema::table ('newcollection ' , function ($ collection ) {
136
136
$ collection ->index (['field_a ' , 'field_b ' ]);
137
137
});
138
138
139
139
$ index = $ this ->getIndex ('newcollection ' , 'field_a_1_field_b_1 ' );
140
140
$ this ->assertNotNull ($ index );
141
141
142
- Schema::collection ('newcollection ' , function ($ collection ) {
142
+ Schema::table ('newcollection ' , function ($ collection ) {
143
143
$ collection ->dropIndex (['field_a ' , 'field_b ' ]);
144
144
});
145
145
146
146
$ index = $ this ->getIndex ('newcollection ' , 'field_a_1_field_b_1 ' );
147
147
$ this ->assertFalse ($ index );
148
148
149
- Schema::collection ('newcollection ' , function ($ collection ) {
149
+ Schema::table ('newcollection ' , function ($ collection ) {
150
150
$ collection ->index (['field_a ' => -1 , 'field_b ' => 1 ]);
151
151
});
152
152
153
153
$ index = $ this ->getIndex ('newcollection ' , 'field_a_-1_field_b_1 ' );
154
154
$ this ->assertNotNull ($ index );
155
155
156
- Schema::collection ('newcollection ' , function ($ collection ) {
156
+ Schema::table ('newcollection ' , function ($ collection ) {
157
157
$ collection ->dropIndex (['field_a ' => -1 , 'field_b ' => 1 ]);
158
158
});
159
159
160
160
$ index = $ this ->getIndex ('newcollection ' , 'field_a_-1_field_b_1 ' );
161
161
$ this ->assertFalse ($ index );
162
162
163
- Schema::collection ('newcollection ' , function ($ collection ) {
163
+ Schema::table ('newcollection ' , function ($ collection ) {
164
164
$ collection ->index (['field_a ' , 'field_b ' ], 'custom_index_name ' );
165
165
});
166
166
167
167
$ index = $ this ->getIndex ('newcollection ' , 'custom_index_name ' );
168
168
$ this ->assertNotNull ($ index );
169
169
170
- Schema::collection ('newcollection ' , function ($ collection ) {
170
+ Schema::table ('newcollection ' , function ($ collection ) {
171
171
$ collection ->dropIndex ('custom_index_name ' );
172
172
});
173
173
@@ -177,44 +177,44 @@ public function testDropIndex(): void
177
177
178
178
public function testDropIndexIfExists (): void
179
179
{
180
- Schema::collection ('newcollection ' , function (Blueprint $ collection ) {
180
+ Schema::table ('newcollection ' , function (Blueprint $ collection ) {
181
181
$ collection ->unique ('uniquekey ' );
182
182
$ collection ->dropIndexIfExists ('uniquekey_1 ' );
183
183
});
184
184
185
185
$ index = $ this ->getIndex ('newcollection ' , 'uniquekey ' );
186
186
$ this ->assertEquals (null , $ index );
187
187
188
- Schema::collection ('newcollection ' , function (Blueprint $ collection ) {
188
+ Schema::table ('newcollection ' , function (Blueprint $ collection ) {
189
189
$ collection ->unique ('uniquekey ' );
190
190
$ collection ->dropIndexIfExists (['uniquekey ' ]);
191
191
});
192
192
193
193
$ index = $ this ->getIndex ('newcollection ' , 'uniquekey ' );
194
194
$ this ->assertEquals (null , $ index );
195
195
196
- Schema::collection ('newcollection ' , function (Blueprint $ collection ) {
196
+ Schema::table ('newcollection ' , function (Blueprint $ collection ) {
197
197
$ collection ->index (['field_a ' , 'field_b ' ]);
198
198
});
199
199
200
200
$ index = $ this ->getIndex ('newcollection ' , 'field_a_1_field_b_1 ' );
201
201
$ this ->assertNotNull ($ index );
202
202
203
- Schema::collection ('newcollection ' , function (Blueprint $ collection ) {
203
+ Schema::table ('newcollection ' , function (Blueprint $ collection ) {
204
204
$ collection ->dropIndexIfExists (['field_a ' , 'field_b ' ]);
205
205
});
206
206
207
207
$ index = $ this ->getIndex ('newcollection ' , 'field_a_1_field_b_1 ' );
208
208
$ this ->assertFalse ($ index );
209
209
210
- Schema::collection ('newcollection ' , function (Blueprint $ collection ) {
210
+ Schema::table ('newcollection ' , function (Blueprint $ collection ) {
211
211
$ collection ->index (['field_a ' , 'field_b ' ], 'custom_index_name ' );
212
212
});
213
213
214
214
$ index = $ this ->getIndex ('newcollection ' , 'custom_index_name ' );
215
215
$ this ->assertNotNull ($ index );
216
216
217
- Schema::collection ('newcollection ' , function (Blueprint $ collection ) {
217
+ Schema::table ('newcollection ' , function (Blueprint $ collection ) {
218
218
$ collection ->dropIndexIfExists ('custom_index_name ' );
219
219
});
220
220
@@ -226,19 +226,19 @@ public function testHasIndex(): void
226
226
{
227
227
$ instance = $ this ;
228
228
229
- Schema::collection ('newcollection ' , function (Blueprint $ collection ) use ($ instance ) {
229
+ Schema::table ('newcollection ' , function (Blueprint $ collection ) use ($ instance ) {
230
230
$ collection ->index ('myhaskey1 ' );
231
231
$ instance ->assertTrue ($ collection ->hasIndex ('myhaskey1_1 ' ));
232
232
$ instance ->assertFalse ($ collection ->hasIndex ('myhaskey1 ' ));
233
233
});
234
234
235
- Schema::collection ('newcollection ' , function (Blueprint $ collection ) use ($ instance ) {
235
+ Schema::table ('newcollection ' , function (Blueprint $ collection ) use ($ instance ) {
236
236
$ collection ->index ('myhaskey2 ' );
237
237
$ instance ->assertTrue ($ collection ->hasIndex (['myhaskey2 ' ]));
238
238
$ instance ->assertFalse ($ collection ->hasIndex (['myhaskey2_1 ' ]));
239
239
});
240
240
241
- Schema::collection ('newcollection ' , function (Blueprint $ collection ) use ($ instance ) {
241
+ Schema::table ('newcollection ' , function (Blueprint $ collection ) use ($ instance ) {
242
242
$ collection ->index (['field_a ' , 'field_b ' ]);
243
243
$ instance ->assertTrue ($ collection ->hasIndex (['field_a_1_field_b ' ]));
244
244
$ instance ->assertFalse ($ collection ->hasIndex (['field_a_1_field_b_1 ' ]));
@@ -247,7 +247,7 @@ public function testHasIndex(): void
247
247
248
248
public function testBackground (): void
249
249
{
250
- Schema::collection ('newcollection ' , function ($ collection ) {
250
+ Schema::table ('newcollection ' , function ($ collection ) {
251
251
$ collection ->background ('backgroundkey ' );
252
252
});
253
253
@@ -257,7 +257,7 @@ public function testBackground(): void
257
257
258
258
public function testSparse (): void
259
259
{
260
- Schema::collection ('newcollection ' , function ($ collection ) {
260
+ Schema::table ('newcollection ' , function ($ collection ) {
261
261
$ collection ->sparse ('sparsekey ' );
262
262
});
263
263
@@ -267,7 +267,7 @@ public function testSparse(): void
267
267
268
268
public function testExpire (): void
269
269
{
270
- Schema::collection ('newcollection ' , function ($ collection ) {
270
+ Schema::table ('newcollection ' , function ($ collection ) {
271
271
$ collection ->expire ('expirekey ' , 60 );
272
272
});
273
273
@@ -277,11 +277,11 @@ public function testExpire(): void
277
277
278
278
public function testSoftDeletes (): void
279
279
{
280
- Schema::collection ('newcollection ' , function ($ collection ) {
280
+ Schema::table ('newcollection ' , function ($ collection ) {
281
281
$ collection ->softDeletes ();
282
282
});
283
283
284
- Schema::collection ('newcollection ' , function ($ collection ) {
284
+ Schema::table ('newcollection ' , function ($ collection ) {
285
285
$ collection ->string ('email ' )->nullable ()->index ();
286
286
});
287
287
@@ -291,7 +291,7 @@ public function testSoftDeletes(): void
291
291
292
292
public function testFluent (): void
293
293
{
294
- Schema::collection ('newcollection ' , function ($ collection ) {
294
+ Schema::table ('newcollection ' , function ($ collection ) {
295
295
$ collection ->string ('email ' )->index ();
296
296
$ collection ->string ('token ' )->index ();
297
297
$ collection ->timestamp ('created_at ' );
@@ -306,7 +306,7 @@ public function testFluent(): void
306
306
307
307
public function testGeospatial (): void
308
308
{
309
- Schema::collection ('newcollection ' , function ($ collection ) {
309
+ Schema::table ('newcollection ' , function ($ collection ) {
310
310
$ collection ->geospatial ('point ' );
311
311
$ collection ->geospatial ('area ' , '2d ' );
312
312
$ collection ->geospatial ('continent ' , '2dsphere ' );
@@ -324,7 +324,7 @@ public function testGeospatial(): void
324
324
325
325
public function testDummies (): void
326
326
{
327
- Schema::collection ('newcollection ' , function ($ collection ) {
327
+ Schema::table ('newcollection ' , function ($ collection ) {
328
328
$ collection ->boolean ('activated ' )->default (0 );
329
329
$ collection ->integer ('user_id ' )->unsigned ();
330
330
});
@@ -333,7 +333,7 @@ public function testDummies(): void
333
333
334
334
public function testSparseUnique (): void
335
335
{
336
- Schema::collection ('newcollection ' , function ($ collection ) {
336
+ Schema::table ('newcollection ' , function ($ collection ) {
337
337
$ collection ->sparse_and_unique ('sparseuniquekey ' );
338
338
});
339
339
@@ -361,7 +361,7 @@ public function testRenameColumn(): void
361
361
$ this ->assertArrayNotHasKey ('test ' , $ check [2 ]);
362
362
$ this ->assertArrayNotHasKey ('newtest ' , $ check [2 ]);
363
363
364
- Schema::collection ('newcollection ' , function (Blueprint $ collection ) {
364
+ Schema::table ('newcollection ' , function (Blueprint $ collection ) {
365
365
$ collection ->renameColumn ('test ' , 'newtest ' );
366
366
});
367
367
0 commit comments