File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ class Blueprint extends SchemaBlueprint
2929
3030 /**
3131 * The MongoDB collection object for this blueprint.
32+ * Type added in Laravel 12.
3233 *
3334 * @var Collection
3435 */
Original file line number Diff line number Diff line change @@ -156,7 +156,8 @@ public function getTables($schema = null)
156156
157157 $ collections [] = [
158158 'name ' => $ collectionName ,
159- 'schema ' => null ,
159+ 'schema ' => $ db ->getDatabaseName (),
160+ 'schema_qualified_name ' => $ db ->getDatabaseName () . '. ' . $ collectionName ,
160161 'size ' => $ stats [0 ]?->storageStats?->totalSize ?? null ,
161162 'comment ' => null ,
162163 'collation ' => null ,
@@ -171,7 +172,13 @@ public function getTables($schema = null)
171172 return $ collections ;
172173 }
173174
174- public function getTableListing ($ schema = null , $ schemaQualified = true )
175+ /**
176+ * @param string|null $schema
177+ * @param bool $schemaQualified If a schema is provided, prefix the collection names with the schema name
178+ *
179+ * @return array
180+ */
181+ public function getTableListing ($ schema = null , $ schemaQualified = false )
175182 {
176183 $ collections = [];
177184
Original file line number Diff line number Diff line change @@ -395,6 +395,7 @@ public function testGetTables()
395395 {
396396 DB ::connection ('mongodb ' )->table ('newcollection ' )->insert (['test ' => 'value ' ]);
397397 DB ::connection ('mongodb ' )->table ('newcollection_two ' )->insert (['test ' => 'value ' ]);
398+ $ dbName = DB ::connection ('mongodb ' )->getDatabaseName ();
398399
399400 $ tables = Schema::getTables ();
400401 $ this ->assertIsArray ($ tables );
@@ -403,9 +404,13 @@ public function testGetTables()
403404 foreach ($ tables as $ table ) {
404405 $ this ->assertArrayHasKey ('name ' , $ table );
405406 $ this ->assertArrayHasKey ('size ' , $ table );
407+ $ this ->assertArrayHasKey ('schema ' , $ table );
408+ $ this ->assertArrayHasKey ('schema_qualified_name ' , $ table );
406409
407410 if ($ table ['name ' ] === 'newcollection ' ) {
408411 $ this ->assertEquals (8192 , $ table ['size ' ]);
412+ $ this ->assertEquals ($ dbName , $ table ['schema ' ]);
413+ $ this ->assertEquals ($ dbName . '.newcollection ' , $ table ['schema_qualified_name ' ]);
409414 $ found = true ;
410415 }
411416 }
You can’t perform that action at this time.
0 commit comments