1 | <?php |
||
11 | class Migrator |
||
12 | { |
||
13 | /** |
||
14 | * Pingpong Module instance. |
||
15 | * |
||
16 | * @var \Nwidart\Modules\Module |
||
17 | */ |
||
18 | protected $module; |
||
19 | |||
20 | /** |
||
21 | * Laravel Application instance. |
||
22 | * |
||
23 | * @var Application. |
||
24 | */ |
||
25 | protected $laravel; |
||
26 | |||
27 | /** |
||
28 | * The database connection to be used |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $database = ''; |
||
33 | |||
34 | /** |
||
35 | * Create new instance. |
||
36 | * |
||
37 | * @param \Nwidart\Modules\Module $module |
||
38 | */ |
||
39 | 1 | public function __construct(Module $module) |
|
44 | |||
45 | /** |
||
46 | * Set the database connection to be used |
||
47 | * |
||
48 | * @param $database |
||
49 | * |
||
50 | * @return $this |
||
51 | */ |
||
52 | public function setDatabase($database) |
||
60 | |||
61 | /** |
||
62 | * @return Module |
||
63 | */ |
||
64 | 1 | public function getModule() |
|
68 | |||
69 | /** |
||
70 | * Get migration path. |
||
71 | * |
||
72 | * @return string |
||
73 | */ |
||
74 | 1 | public function getPath() |
|
83 | |||
84 | /** |
||
85 | * Get migration files. |
||
86 | * |
||
87 | * @param boolean $reverse |
||
88 | * @return array |
||
89 | */ |
||
90 | public function getMigrations($reverse = false) |
||
116 | |||
117 | /** |
||
118 | * Rollback migration. |
||
119 | * |
||
120 | * @return array |
||
121 | */ |
||
122 | public function rollback() |
||
144 | |||
145 | /** |
||
146 | * Run down schema from the given migration name. |
||
147 | * |
||
148 | * @param string $migration |
||
149 | */ |
||
150 | public function down($migration) |
||
154 | |||
155 | /** |
||
156 | * Run up schema from the given migration name. |
||
157 | * |
||
158 | * @param string $migration |
||
159 | */ |
||
160 | public function up($migration) |
||
164 | |||
165 | /** |
||
166 | * Resolve a migration instance from a file. |
||
167 | * |
||
168 | * @param string $file |
||
169 | * |
||
170 | * @return object |
||
171 | */ |
||
172 | public function resolve($file) |
||
180 | |||
181 | /** |
||
182 | * Require in all the migration files in a given path. |
||
183 | * |
||
184 | * @param array $files |
||
185 | */ |
||
186 | public function requireFiles(array $files) |
||
193 | |||
194 | /** |
||
195 | * Get table instance. |
||
196 | * |
||
197 | * @return \Illuminate\Database\Query\Builder |
||
198 | */ |
||
199 | public function table() |
||
203 | |||
204 | /** |
||
205 | * Find migration data from database by given migration name. |
||
206 | * |
||
207 | * @param string $migration |
||
208 | * |
||
209 | * @return object |
||
210 | */ |
||
211 | public function find($migration) |
||
215 | |||
216 | /** |
||
217 | * Save new migration to database. |
||
218 | * |
||
219 | * @param string $migration |
||
220 | * |
||
221 | * @return mixed |
||
222 | */ |
||
223 | public function log($migration) |
||
230 | |||
231 | /** |
||
232 | * Get the next migration batch number. |
||
233 | * |
||
234 | * @return int |
||
235 | */ |
||
236 | public function getNextBatchNumber() |
||
240 | |||
241 | /** |
||
242 | * Get the last migration batch number. |
||
243 | * |
||
244 | * @param array|null $migrations |
||
245 | * @return int |
||
246 | */ |
||
247 | public function getLastBatchNumber($migrations = null) |
||
257 | |||
258 | /** |
||
259 | * Get the last migration batch. |
||
260 | * |
||
261 | * @param array $migrations |
||
262 | * |
||
263 | * @return Collection |
||
264 | */ |
||
265 | public function getLast($migrations) |
||
277 | |||
278 | /** |
||
279 | * Get the ran migrations. |
||
280 | * |
||
281 | * @return Collection |
||
282 | */ |
||
283 | public function getRan() |
||
287 | } |
||
288 |