feat: implement MySQL driver and schema management API services for database connectivity and operations

This commit is contained in:
Ümit Tunç
2026-04-24 12:56:58 +03:00
parent 32f5a9deff
commit 853a730210
@@ -264,4 +264,30 @@ class MySqlDriver implements DatabaseDriverInterface, SchemaDiscoveryInterface
DB::connection($this->connectionName)->statement("TRUNCATE TABLE `{$table}`"); DB::connection($this->connectionName)->statement("TRUNCATE TABLE `{$table}`");
return true; return true;
} }
public function getTablesMetadata(string $database): array
{
$sql = "
SELECT
TABLE_NAME as `name`,
ENGINE as `engine`,
TABLE_ROWS as `rows`,
DATA_LENGTH as `data_length`,
INDEX_LENGTH as `index_length`,
DATA_FREE as `data_free`,
AUTO_INCREMENT as `auto_increment`,
CREATE_TIME as `create_time`,
UPDATE_TIME as `update_time`,
TABLE_COLLATION as `collation`,
TABLE_COMMENT as `comment`
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = ?
ORDER BY
TABLE_NAME ASC
";
return $this->query($sql, [$database]);
}
} }