Skip to content

Commit

Permalink
Fixed bug with image attribute name
Browse files Browse the repository at this point in the history
  • Loading branch information
execut committed Sep 10, 2017
1 parent 0cbc328 commit 7ae10ca
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Attacher.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,35 @@ public function initInverter(Inverter $i) {
'title',
'alt'
];

foreach ($attributes as $attribute) {
$cacheKey = __CLASS__ . '_' . $table . '_' . $attribute;
if ($cache->get($cacheKey)) {
continue;
}
$tableSchema = $this->db->getTableSchema($table);
if (!$tableSchema) {
continue 2;
}

if (!$tableSchema->getColumn($attribute)) {
$i->table($table)->addColumn($attribute, $this->string());
}

$i->table($table)->addColumn($attribute, $this->string());
$cache->set($cacheKey, 1);
}
foreach ($this->sizes as $size => $sizeParams) {
$sizeName = 'size_' . $size;

foreach ($this->sizes as $sizeName => $sizeParams) {
$cacheKey = __CLASS__ . '_' . $table . '_' . $sizeName;
if ($cache->get($cacheKey)) {
continue;
}

$isAttached = $this->db->getTableSchema($table)->getColumn($sizeName);
$tableSchema = $this->db->getTableSchema($table);
if (!$tableSchema) {
continue 2;
}
$isAttached = $tableSchema->getColumn($sizeName);
if (!$isAttached) {
$helper = new MigrationHelper([
'table' => $i->table($table),
Expand Down

0 comments on commit 7ae10ca

Please sign in to comment.