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,8 @@ public function getTableListing($schema = null, $schemaQualified = false)
197
214
return $ collections ;
198
215
}
199
216
217
+ /** @inheritdoc */
218
+ #[Override]
200
219
public function getColumns ($ table )
201
220
{
202
221
$ db = null ;
@@ -255,6 +274,8 @@ public function getColumns($table)
255
274
return $ columns ;
256
275
}
257
276
277
+ /** @inheritdoc */
278
+ #[Override]
258
279
public function getIndexes ($ table )
259
280
{
260
281
$ collection = $ this ->connection ->getDatabase ()->selectCollection ($ table );
@@ -309,12 +330,19 @@ public function getIndexes($table)
309
330
return $ indexList ;
310
331
}
311
332
333
+ /** @inheritdoc */
334
+ #[Override]
312
335
public function getForeignKeys ($ table )
313
336
{
314
337
return [];
315
338
}
316
339
317
- /** @inheritdoc */
340
+ /**
341
+ * @return Blueprint
342
+ *
343
+ * @inheritdoc
344
+ */
345
+ #[Override]
318
346
protected function createBlueprint ($ table , ?Closure $ callback = null )
319
347
{
320
348
return new Blueprint ($ this ->connection , $ table );
0 commit comments