File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
src/Jenssegers/Mongodb/Schema Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -106,11 +106,38 @@ public function drop($collection)
106
106
return $ blueprint ->drop ();
107
107
}
108
108
109
+ /**
110
+ * @inheritdoc
111
+ */
112
+ public function dropAllTables ()
113
+ {
114
+ foreach ($ this ->getAllCollections () as $ collection ) {
115
+ $ this ->drop ($ collection );
116
+ }
117
+ }
118
+
109
119
/**
110
120
* @inheritdoc
111
121
*/
112
122
protected function createBlueprint ($ collection , Closure $ callback = null )
113
123
{
114
124
return new Blueprint ($ this ->connection , $ collection );
115
125
}
126
+
127
+ /**
128
+ * Get all of the collections names for the database.
129
+ *
130
+ * @return array
131
+ */
132
+ protected function getAllCollections ()
133
+ {
134
+
135
+ $ collections = [];
136
+ foreach ($ this ->connection ->getMongoDB ()->listCollections () as $ collection ) {
137
+ $ collections [] = $ collection ->getName ();
138
+ }
139
+
140
+ return $ collections ;
141
+ }
142
+
116
143
}
You can’t perform that action at this time.
0 commit comments