Skip to content

Commit

Permalink
Prepare 5.0.1 release.
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Apr 3, 2020
1 parent 9f4e3d4 commit 78a02e8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG-5.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ This changelog references the relevant changes (bug and security fixes) done to

Released: 2020-04-03

### Changes

* Throw exception when trying to make migration file without `--table` option on shared database configuration.

### Fixes

* Fixes migration stub files.
Expand Down
5 changes: 1 addition & 4 deletions src/Console/MigrateMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Orchestra\Tenanti\Console;

use Illuminate\Support\Composer;
use InvalidArgumentException;
use Orchestra\Tenanti\Migrator\MigrationWriter;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -41,9 +40,7 @@ public function handle(Composer $composer)
$create = $this->input->getOption('create') ?? false;
$table = $this->input->getOption('table');

if (\is_bool($create) && empty($table)) {
throw new InvalidArgumentException('Please set the table name for this migration using --table option!');
} elseif (! $table && \is_string($create)) {
if (! $table && \is_string($create)) {
$table = $create;
}

Expand Down
5 changes: 5 additions & 0 deletions src/Migrator/MigrationWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Database\Migrations\MigrationCreator;
use Illuminate\Filesystem\Filesystem;
use InvalidArgumentException;
use Orchestra\Support\Str;
use Orchestra\Tenanti\TenantiManager;

Expand Down Expand Up @@ -42,6 +43,10 @@ public function __invoke(
}

if ($this->tenant->config("{$driver}.shared", true) === true) {
if (empty($table)) {
throw new InvalidArgumentException('Require table name for shared database migration!');
}

$table = Str::replace($migrator->tablePrefix()."_{$table}", ['id' => '{$id}']);
}

Expand Down

0 comments on commit 78a02e8

Please sign in to comment.