3
namespace Upside\Db\Test;
5
use Upside\Db\Schema\CreateTable;
6
use Upside\Db\Schema as BaseSchema;
7
use Upside\Db\Schema\AlterTable;
9
class Schema extends BaseSchema
11
public function create(string $table, callable $callback)
13
$compiler = $this->connection->schema_compiler();
15
$schema = new CreateTable($table);
19
return \implode("\n", \array_map(static function ($value) {
21
}, $compiler->create($schema)));
24
public function alter(string $table, callable $callback)
26
$compiler = $this->connection->schema_compiler();
28
$schema = new AlterTable($table);
32
return \implode("\n", \array_map(static function ($value) {
34
}, $compiler->alter($schema)));
37
public function rename_table(string $table, string $name)
39
$result = $this->connection->schema_compiler()->rename_table($table, $name);
41
return implode("\n", \array_map(static function ($value) {
46
public function drop(string $table)
48
$compiler = $this->connection->schema_compiler();
50
return implode("\n", array_map(function ($value) {
52
}, $compiler->drop($table)));
55
public function truncate(string $table)
57
$compiler = $this->connection->schema_compiler();
59
return implode("\n", array_map(function ($value) {
61
}, $compiler->truncate($table)));