Skip to content

Commit

Permalink
platform: better handling of empty schema & meta
Browse files Browse the repository at this point in the history
  • Loading branch information
hrach committed Nov 15, 2020
1 parent 0d3096b commit 51b930c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Platforms/Data/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ class Column
* @var mixed[]
* @phpstan-var array<string, mixed>
*/
public $meta;
public $meta = [];
}
12 changes: 10 additions & 2 deletions src/Platforms/Data/ForeignKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,20 @@ class ForeignKey

public function getNameFqn(): string
{
return "$this->schema.$this->name";
if ($this->schema === '') {
return $this->name;
} else {
return "$this->schema.$this->name";
}
}


public function getRefTableFqn(): string
{
return "$this->refTableSchema.$this->refTable";
if ($this->refTableSchema === '') {
return $this->refTable;
} else {
return "$this->refTableSchema.$this->refTable";
}
}
}
6 changes: 5 additions & 1 deletion src/Platforms/Data/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class Table

public function getNameFqn(): string
{
return "$this->schema.$this->name";
if ($this->schema === '') {
return $this->name;
} else {
return "$this->schema.$this->name";
}
}
}

0 comments on commit 51b930c

Please sign in to comment.