6
6
7
7
use Closure ;
8
8
use MongoDB \Collection ;
9
- use MongoDB \Database ;
10
9
use MongoDB \Driver \Exception \ServerException ;
11
10
use MongoDB \Laravel \Connection ;
12
11
use MongoDB \Model \CollectionInfo ;
13
12
use MongoDB \Model \IndexInfo ;
13
+ use Override ;
14
14
15
15
use function array_column ;
16
16
use function array_fill_keys ;
@@ -99,12 +99,14 @@ public function hasCollection($name)
99
99
}
100
100
101
101
/** @inheritdoc */
102
+ #[Override]
102
103
public function hasTable ($ table )
103
104
{
104
105
return $ this ->hasCollection ($ table );
105
106
}
106
107
107
108
/** @inheritdoc */
109
+ #[Override]
108
110
public function table ($ table , Closure $ callback )
109
111
{
110
112
$ blueprint = $ this ->createBlueprint ($ table );
@@ -115,6 +117,7 @@ public function table($table, Closure $callback)
115
117
}
116
118
117
119
/** @inheritdoc */
120
+ #[Override]
118
121
public function create ($ table , ?Closure $ callback = null , array $ options = [])
119
122
{
120
123
$ blueprint = $ this ->createBlueprint ($ table );
@@ -127,6 +130,7 @@ public function create($table, ?Closure $callback = null, array $options = [])
127
130
}
128
131
129
132
/** @inheritdoc */
133
+ #[Override]
130
134
public function dropIfExists ($ table )
131
135
{
132
136
if ($ this ->hasCollection ($ table )) {
@@ -135,6 +139,7 @@ public function dropIfExists($table)
135
139
}
136
140
137
141
/** @inheritdoc */
142
+ #[Override]
138
143
public function drop ($ table )
139
144
{
140
145
$ blueprint = $ this ->createBlueprint ($ table );
@@ -151,18 +156,29 @@ public function drop($table)
151
156
* one by one. The database will be automatically recreated when a new connection
152
157
* writes to it.
153
158
*/
159
+ #[Override]
154
160
public function dropAllTables ()
155
161
{
156
162
$ this ->connection ->getDatabase ()->drop ();
157
163
}
158
164
159
- /** @param string|null $schema Database name */
165
+ /**
166
+ * @param string|null $schema Database name
167
+ *
168
+ * @inheritdoc
169
+ */
170
+ #[Override]
160
171
public function getTables ($ schema = null )
161
172
{
162
173
return $ this ->getCollectionRows ('collection ' , $ schema );
163
174
}
164
175
165
- /** @param string|null $schema Database name */
176
+ /**
177
+ * @param string|null $schema Database name
178
+ *
179
+ * @inheritdoc
180
+ */
181
+ #[Override]
166
182
public function getViews ($ schema = null )
167
183
{
168
184
return $ this ->getCollectionRows ('view ' , $ schema );
@@ -174,6 +190,7 @@ public function getViews($schema = null)
174
190
*
175
191
* @return array
176
192
*/
193
+ #[Override]
177
194
public function getTableListing ($ schema = null , $ schemaQualified = false )
178
195
{
179
196
$ collections = [];
@@ -197,6 +214,7 @@ public function getTableListing($schema = null, $schemaQualified = false)
197
214
return $ collections ;
198
215
}
199
216
217
+ #[Override]
200
218
public function getColumns ($ table )
201
219
{
202
220
$ db = null ;
@@ -255,6 +273,7 @@ public function getColumns($table)
255
273
return $ columns ;
256
274
}
257
275
276
+ #[Override]
258
277
public function getIndexes ($ table )
259
278
{
260
279
$ collection = $ this ->connection ->getDatabase ()->selectCollection ($ table );
@@ -309,12 +328,18 @@ public function getIndexes($table)
309
328
return $ indexList ;
310
329
}
311
330
331
+ #[Override]
312
332
public function getForeignKeys ($ table )
313
333
{
314
334
return [];
315
335
}
316
336
317
- /** @inheritdoc */
337
+ /**
338
+ * @return Blueprint
339
+ *
340
+ * @inheritdoc
341
+ */
342
+ #[Override]
318
343
protected function createBlueprint ($ table , ?Closure $ callback = null )
319
344
{
320
345
return new Blueprint ($ this ->connection , $ table );
0 commit comments