1 | <?php |
||
8 | class DatabaseMigrationRepository implements MigrationRepository |
||
9 | { |
||
10 | /** |
||
11 | * The active database connection. |
||
12 | * |
||
13 | * @var Pdo |
||
14 | */ |
||
15 | protected $connection = null; |
||
16 | |||
17 | /** |
||
18 | * Set the repository connection on the object. |
||
19 | * |
||
20 | * @param Pdo $connection |
||
21 | */ |
||
22 | public function setConnection($connection) |
||
26 | |||
27 | /** |
||
28 | * Return true if repository resource exists. |
||
29 | * |
||
30 | * @return bool |
||
31 | */ |
||
32 | public function exists() |
||
36 | |||
37 | /** |
||
38 | * Create a new repository resource. |
||
39 | */ |
||
40 | public function create() |
||
46 | |||
47 | /** |
||
48 | * Return the migrations that have already been ran. |
||
49 | * |
||
50 | * @param array $ran |
||
51 | * @param int $steps |
||
52 | * |
||
53 | * @return array |
||
54 | */ |
||
55 | public function getRan($ran = null, $steps = null) |
||
72 | |||
73 | /** |
||
74 | * Get array of all migrations that have been run. |
||
75 | * |
||
76 | * @param array $ran |
||
77 | * @param int $steps |
||
78 | * |
||
79 | * @return array |
||
80 | */ |
||
81 | public function getRanMigrations($ran = null, $steps = null) |
||
89 | |||
90 | /** |
||
91 | * Get array of all migration batch nubmers that have run. |
||
92 | * |
||
93 | * @param array $ran |
||
94 | * |
||
95 | * @return array |
||
96 | */ |
||
97 | public function getRanBatchNumbers($ran = null) |
||
105 | |||
106 | /** |
||
107 | * Get the last number found in the repository. |
||
108 | * |
||
109 | * @param array $ran |
||
110 | * |
||
111 | * @return int |
||
112 | */ |
||
113 | public function getLastBatchNumber($ran = null) |
||
119 | |||
120 | /** |
||
121 | * Get the next available batch number. |
||
122 | * |
||
123 | * @param array $ran |
||
124 | * |
||
125 | * @return int |
||
126 | */ |
||
127 | public function getNextBatchNumber($ran = null) |
||
131 | |||
132 | /** |
||
133 | * Insert a new record in the repository. |
||
134 | * |
||
135 | * @param string $fileName |
||
136 | * @param int $batch |
||
137 | */ |
||
138 | public function insertRecord($fileName, $batch) |
||
146 | |||
147 | /** |
||
148 | * Delete a record from the repository. |
||
149 | * |
||
150 | * @param string $fileName |
||
151 | */ |
||
152 | public function deleteRecord($fileName) |
||
160 | } |
||
161 |