Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/Schema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare (strict_types = 1);

/**
* @author : Jagepard <jagepard@yandex.ru">
* @license https://mit-license.org/ MIT
*/

namespace Rudra\Model;

use Rudra\Container\Facades\Rudra;

class Schema
{
private QB $qb;

public static function create(string $table, callable $callback): self
{
$qb = Entity::qb()->create($table);
$callback($qb);
$self = new self();
$self->qb = $qb;
return $self;
}

public function execute(): bool
{
$sql = $this->qb->close()->get();
return Rudra::get("DSN")->prepare($sql)->execute();
}
}
Loading