maxlcoder/laravel-dm8
Integrate DM8 (Dameng) databases into Laravel with this driver package. It adds connection support so you can use Laravel's query builder, Eloquent models, and standard database configuration with DM8, helping teams build apps on a Chinese domestic database without leaving the Laravel ecosystem.
This package extends Laravel's schema grammar with compileTables() and compileColumns() — the SQL compilers behind Laravel's schema introspection facade (Schema::getTables() / Schema::getColumns()). Start by confirming you're on a Laravel version that exposes those introspection methods (10.x+ / 11.x).
First steps:
Schema::connection('mydb')->getTables();
Schema::connection('mydb')->getColumns('users');
DB::connection('mydb')->listen(fn ($q) => dump($q->sql)) if the output looks wrong — the compiled SQL is what you'll debug most often.First use case: using getTables()/getColumns() to drive a migration diff, a schema-dump command, or an admin UI that lists tables and column metadata without handcrafted queries.
Schema introspection for tooling. The primary consumer of compileTables/compileColumns is anything that needs to reflect a schema: db:table-style commands, migration generators, diffing tools, or data-warehouse UIs. Wrap them in a small service rather than calling Schema:: directly throughout your app:
final class SchemaInspector
{
public function tables(): array
{
return Schema::connection($this->name)->getTables();
}
public function columns(string $table): array
{
return Schema::connection($this->name)->getColumns($table);
}
}
Multi-driver awareness. If the package wraps a non-default driver (ClickHouse, a columnar store, an external warehouse), keep the connection name configurable and inject it. Don't hardcode the default connection — compileColumns is driver-specific and calling it on the wrong connection will produce SQL the other engine rejects.
Migration/schema-dump integration. Hook the introspected schema into your own schema:dump equivalent by iterating getTables() and calling getColumns() per table. This is the most common real-world pattern: the compiler functions exist so tooling can build a schema representation without raw information_schema queries.
Assertions in tests. Assert on the shape of the returned arrays (keys like name, type, nullable, default) rather than exact driver strings, since type names differ across engines.
Schema::getTables()/getColumns() arrive with Laravel 10.x's schema introspection API. On older Laravel versions the compilers exist but nothing calls them — you'll need to invoke the grammar's compileTables/compileColumns manually or upgrade.getSchemaGrammar() returns the default grammar instead of the package's, you'll get MethodDoesNotExist or, worse, base-grammar SQL. Verify the provider actually swaps the grammar for your driver.compileColumns needs a table name compiled safely — pass through Laravel's wrapTable() semantics. If you're calling the compiler directly (not via Schema::), make sure the table is wrapped to avoid reserved-word failures.getColumns() output isn't fully normalized across engines; don't assume every key (collation, comment, etc.) exists. Use array_key_exists or null-safe reads when building UIs.getTables()/getColumns() call hits the database. In admin panels or loops, memoize per-request; these compilers are cheap to call but not free.compileTableOptions()-style methods rather than post-processing raw query results.How can I help you explore Laravel packages today?