Skip to content

Commit

Permalink
Merge pull request #3 from abdumu/master
Browse files Browse the repository at this point in the history
updated for 5.8
  • Loading branch information
BSN4 authored Apr 28, 2019
2 parents f209742 + 3e21919 commit cfae9b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
],
"require": {
"php": "~5.6|~7.0",
"illuminate/support": "5.6.* || 5.7.*",
"spatie/regex": "^1.3",
"doctrine/dbal": "^2.8"
"illuminate/support": "5.6.* || 5.7.* || 5.8.*",
"spatie/regex": "^1.4",
"doctrine/dbal": "^2.9"
},
"autoload": {
"psr-4": {
Expand Down
11 changes: 9 additions & 2 deletions src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ class Schema
public function __construct($schema, SyncMigrateCommand $writeIn)
{
$this->schema = $schema;
$this->writeIn = $writeIn;

$this->name = $this->getName($schema->group(1));
$this->table = DB::getTablePrefix() . $this->name;
$this->writeIn = $writeIn;
}

public function process()
Expand All @@ -51,7 +52,7 @@ protected function create()
eval($this->schema->group(2));
});

$this->output()->warn("New table <fg=white;bg=red> {$this->table} </> was created");
$this->output()->warn("New table <fg=white;bg=green> {$this->table} </> was created");
}

protected function sync()
Expand Down Expand Up @@ -86,6 +87,12 @@ protected function schemaEmpty()

protected function getName($name)
{
//TODO: https://github.com/awssat/laravel-sync-migration/issues/2
if(preg_match('/[\'|"]\s?\.\s?\$/', $name) || preg_match('/\$[a-zA-z0-9-_]+\s?\.\s?[\'|"]/', $name)) {
$this->output()->error("Using variables as table names (<fg=black;bg=white> {$name} </>) is not supported currentlly, see <href=https://github.com/awssat/laravel-sync-migration/issues/2> issue#2 </>");
exit;
}

return str_replace(['\'', '"'], '', $name);
}

Expand Down

0 comments on commit cfae9b6

Please sign in to comment.