feat: implement MySQL driver and schema management API services for database connectivity and operations
This commit is contained in:
@@ -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]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user