Skip to content

Commit

Permalink
Merge pull request #202 from dcanaud/master
Browse files Browse the repository at this point in the history
Fix issue on the generated migration file
  • Loading branch information
franzose authored Jan 10, 2018
2 parents 0056fdb + 1acc23a commit 3f69666
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
9 changes: 8 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,12 @@
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"extra": {
"laravel": {
"providers": [
"Franzose\\ClosureTable\\ClosureTableServiceProvider"
]
}
}
}
11 changes: 7 additions & 4 deletions src/Franzose/ClosureTable/Generators/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@ public function create(array $options)
$stubPrefix = $useInnoDB ? '-innodb' : '';

$path = $this->getPath($options['entity-table'], $options['migrations-path']);
$stub = $this->getPath('migration' . $stubPrefix, 'migrations');
$stub = $this->getStub('migration' . $stubPrefix, 'migrations');

$this->filesystem->put($path, $this->parseStub($stub), [
$this->filesystem->put(
$path,
$this->parseStub($stub, [
'entity_table' => $options['entity-table'],
'entity_class' => $entityClass,
'closure_table' => $options['closure-table'],
'closure_class' => $closureClass,
]);
])
);

return [$path];
}
Expand Down Expand Up @@ -80,6 +83,6 @@ protected function getPath($name, $path)
}
$this->usedTimestamps[] = $timestamp;

return $path . '/' . $timestamp->format('Y_m_d_His') . '_' . $this->getName($name) . '.php';
return $path . '/' . $timestamp->format('Y_m_d_His') . '_' . $this->getName($name) . '_migration.php';
}
}

0 comments on commit 3f69666

Please sign in to comment.