1 | <?php |
||
9 | class BitrixDatabaseStorage implements DatabaseStorageInterface |
||
10 | { |
||
11 | /** |
||
12 | * Bitrix $DB object. |
||
13 | * |
||
14 | * @var CDatabase |
||
15 | */ |
||
16 | protected $db; |
||
17 | |||
18 | /** |
||
19 | * Table in DB to store migrations that have been already ran. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $table; |
||
24 | |||
25 | /** |
||
26 | * BitrixDatabaseStorage constructor. |
||
27 | * |
||
28 | * @param $table |
||
29 | */ |
||
30 | public function __construct($table) |
||
37 | |||
38 | /** |
||
39 | * Check if a given table already exists. |
||
40 | * |
||
41 | * @return bool |
||
42 | */ |
||
43 | public function checkMigrationTableExistence() |
||
47 | |||
48 | /** |
||
49 | * Create migration table. |
||
50 | * |
||
51 | * @return void |
||
52 | */ |
||
53 | public function createMigrationTable() |
||
57 | |||
58 | /** |
||
59 | * Get an array of migrations the have been ran previously. |
||
60 | * Must be ordered by order asc. |
||
61 | * |
||
62 | * @return array |
||
63 | */ |
||
64 | public function getRanMigrations() |
||
75 | |||
76 | /** |
||
77 | * Save migration name to the database to prevent it from running again. |
||
78 | * |
||
79 | * @param string $name |
||
80 | * |
||
81 | * @return void |
||
82 | */ |
||
83 | public function logSuccessfulMigration($name) |
||
89 | |||
90 | /** |
||
91 | * Remove a migration name from the database so it can be run again. |
||
92 | * |
||
93 | * @param string $name |
||
94 | * |
||
95 | * @return void |
||
96 | */ |
||
97 | public function removeSuccessfulMigrationFromLog($name) |
||
101 | |||
102 | /** |
||
103 | * Start transaction |
||
104 | */ |
||
105 | public function startTransaction() |
||
109 | |||
110 | /** |
||
111 | * Commit transaction |
||
112 | */ |
||
113 | public function commitTransaction() |
||
117 | |||
118 | /** |
||
119 | * Rollback transaction |
||
120 | */ |
||
121 | public function rollbackTransaction() |
||
125 | |||
126 | /** |
||
127 | * @inheritDoc |
||
128 | */ |
||
129 | public function getTableName() |
||
133 | } |
||
134 |