refactor: susun semula struktur folder — Laravel source ke src/

This commit is contained in:
Saufi
2026-05-19 15:58:35 +08:00
parent f052251b94
commit bf53c71b45
10806 changed files with 1385379 additions and 121 deletions

View File

@@ -0,0 +1,89 @@
<?php
declare(strict_types=1);
namespace Laravel\Boost\Mcp\Tools\DatabaseSchema;
use Exception;
use Illuminate\Support\Facades\DB;
class MySQLSchemaDriver extends DatabaseSchemaDriver
{
public function getViews(): array
{
try {
return DB::connection($this->connection)->select('
SELECT TABLE_NAME as name, VIEW_DEFINITION as definition
FROM information_schema.VIEWS
WHERE TABLE_SCHEMA = DATABASE()
');
} catch (Exception) {
return [];
}
}
public function getStoredProcedures(): array
{
try {
return DB::connection($this->connection)->select('SHOW PROCEDURE STATUS WHERE Db = DATABASE()');
} catch (Exception) {
return [];
}
}
public function getFunctions(): array
{
try {
return DB::connection($this->connection)->select('SHOW FUNCTION STATUS WHERE Db = DATABASE()');
} catch (Exception) {
return [];
}
}
public function getTriggers(?string $table = null): array
{
try {
if ($this->hasTable($table)) {
return DB::connection($this->connection)->select('SHOW TRIGGERS WHERE `Table` = ?', [$table]);
}
return DB::connection($this->connection)->select('SHOW TRIGGERS');
} catch (Exception) {
return [];
}
}
public function getCheckConstraints(string $table): array
{
try {
return DB::connection($this->connection)->select('
SELECT CONSTRAINT_NAME, CHECK_CLAUSE
FROM information_schema.CHECK_CONSTRAINTS
WHERE CONSTRAINT_SCHEMA = DATABASE()
AND TABLE_NAME = ?
', [$table]);
} catch (Exception) {
return [];
}
}
public function getSequences(): array
{
return [];
}
public function getTables(): array
{
try {
return DB::connection($this->connection)->select('
SELECT TABLE_NAME as name
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_TYPE = "BASE TABLE"
ORDER BY TABLE_NAME
');
} catch (Exception) {
return [];
}
}
}