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 | * Run down schema from the given migration name. |
||
119 | * |
||
120 | * @param string $migration |
||
121 | */ |
||
122 | public function down($migration) |
||
126 | |||
127 | /** |
||
128 | * Run up schema from the given migration name. |
||
129 | * |
||
130 | * @param string $migration |
||
131 | */ |
||
132 | public function up($migration) |
||
136 | |||
137 | /** |
||
138 | * Resolve a migration instance from a file. |
||
139 | * |
||
140 | * @param string $file |
||
141 | * |
||
142 | * @return object |
||
143 | */ |
||
144 | public function resolve($file) |
||
152 | |||
153 | /** |
||
154 | * Require in all the migration files in a given path. |
||
155 | * |
||
156 | * @param array $files |
||
157 | */ |
||
158 | public function requireFiles(array $files) |
||
165 | |||
166 | /** |
||
167 | * Get table instance. |
||
168 | * |
||
169 | * @return \Illuminate\Database\Query\Builder |
||
170 | */ |
||
171 | public function table() |
||
175 | |||
176 | /** |
||
177 | * Find migration data from database by given migration name. |
||
178 | * |
||
179 | * @param string $migration |
||
180 | * |
||
181 | * @return object |
||
182 | */ |
||
183 | public function find($migration) |
||
187 | |||
188 | /** |
||
189 | * Save new migration to database. |
||
190 | * |
||
191 | * @param string $migration |
||
192 | * |
||
193 | * @return mixed |
||
194 | */ |
||
195 | public function log($migration) |
||
202 | |||
203 | /** |
||
204 | * Get the next migration batch number. |
||
205 | * |
||
206 | * @return int |
||
207 | */ |
||
208 | public function getNextBatchNumber() |
||
212 | |||
213 | /** |
||
214 | * Get the last migration batch number. |
||
215 | * |
||
216 | * @param array|null $migrations |
||
217 | * @return int |
||
218 | */ |
||
219 | public function getLastBatchNumber($migrations = null) |
||
229 | |||
230 | /** |
||
231 | * Get the last migration batch. |
||
232 | * |
||
233 | * @param array $migrations |
||
234 | * |
||
235 | * @return Collection |
||
236 | */ |
||
237 | public function getLast($migrations) |
||
249 | |||
250 | /** |
||
251 | * Get the ran migrations. |
||
252 | * |
||
253 | * @return Collection |
||
254 | */ |
||
255 | public function getRan() |
||
259 | } |
||
260 |