1 | <?php |
||
15 | class SQLiteHandler extends AbstractHandler |
||
16 | { |
||
17 | /** |
||
18 | * Drop table from database. |
||
19 | * |
||
20 | * @param AbstractTable $table |
||
21 | * |
||
22 | * @throws HandlerException |
||
23 | */ |
||
24 | public function dropTable(AbstractTable $table) |
||
28 | |||
29 | /** |
||
30 | * {@inheritdoc} |
||
31 | */ |
||
32 | public function syncTable(AbstractTable $table, int $behaviour = self::DO_ALL) |
||
70 | |||
71 | /** |
||
72 | * {@inheritdoc} |
||
73 | */ |
||
74 | public function createColumn(AbstractTable $table, AbstractColumn $column) |
||
78 | |||
79 | /** |
||
80 | * {@inheritdoc} |
||
81 | */ |
||
82 | public function dropColumn(AbstractTable $table, AbstractColumn $column) |
||
86 | |||
87 | /** |
||
88 | * {@inheritdoc} |
||
89 | */ |
||
90 | public function alterColumn( |
||
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | public function createForeign(AbstractTable $table, AbstractReference $foreign) |
||
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | public function dropForeign(AbstractTable $table, AbstractReference $foreign) |
||
113 | |||
114 | /** |
||
115 | * {@inheritdoc} |
||
116 | */ |
||
117 | public function alterForeign( |
||
124 | |||
125 | /** |
||
126 | * Rebuild is required when columns or foreign keys are altered. |
||
127 | * |
||
128 | * @param AbstractTable $table |
||
129 | * |
||
130 | * @return bool |
||
131 | */ |
||
132 | private function requiresRebuild(AbstractTable $table): bool |
||
151 | |||
152 | /** |
||
153 | * Temporary table based on parent. |
||
154 | * |
||
155 | * @param AbstractTable $table |
||
156 | * |
||
157 | * @return AbstractTable |
||
158 | */ |
||
159 | protected function createTemporary(AbstractTable $table): AbstractTable |
||
174 | |||
175 | /** |
||
176 | * Copy table data to another location. |
||
177 | * |
||
178 | * @see http://stackoverflow.com/questions/4007014/alter-column-in-sqlite |
||
179 | * |
||
180 | * @param string $source |
||
181 | * @param string $to |
||
182 | * @param array $mapping (destination => source) |
||
183 | * |
||
184 | * @throws HandlerException |
||
185 | */ |
||
186 | private function copyData(string $source, string $to, array $mapping) |
||
216 | |||
217 | /** |
||
218 | * Get mapping between new and initial columns. |
||
219 | * |
||
220 | * @param AbstractTable $source |
||
221 | * @param AbstractTable $target |
||
222 | * |
||
223 | * @return array |
||
224 | */ |
||
225 | private function createMapping(AbstractTable $source, AbstractTable $target) |
||
236 | } |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.