Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
47 | protected function createIndexName($type, array $columns) |
||
48 | { |
||
49 | $short_type = [ |
||
50 | 'primary' => 'pk', |
||
51 | 'foreign' => 'fk', |
||
52 | 'unique' => 'uk', |
||
53 | ]; |
||
54 | |||
55 | $type = isset($short_type[$type]) ? $short_type[$type] : $type; |
||
56 | |||
57 | $index = strtolower($this->prefix . $this->table . '_' . implode('_', $columns) . '_' . $type); |
||
58 | |||
59 | // max index name length is 30 chars |
||
60 | return substr(str_replace(['-', '.'], '_', $index), 0, 30); |
||
61 | } |
||
62 | |||
75 |