From 853a7302109e6b031a1723039b050e043b86f87d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20Tun=C3=A7?= Date: Fri, 24 Apr 2026 12:56:58 +0300 Subject: [PATCH] feat: implement MySQL driver and schema management API services for database connectivity and operations --- backend/app/Services/Database/MySqlDriver.php | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/backend/app/Services/Database/MySqlDriver.php b/backend/app/Services/Database/MySqlDriver.php index d30f87c..a066724 100644 --- a/backend/app/Services/Database/MySqlDriver.php +++ b/backend/app/Services/Database/MySqlDriver.php @@ -264,4 +264,30 @@ class MySqlDriver implements DatabaseDriverInterface, SchemaDiscoveryInterface DB::connection($this->connectionName)->statement("TRUNCATE TABLE `{$table}`"); 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]); + } }