Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save beingsane/26b75e5d7ce1e424dc53c4a0ec979156 to your computer and use it in GitHub Desktop.
Save beingsane/26b75e5d7ce1e424dc53c4a0ec979156 to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Support\Facades\DB;
$query = "SELECT tables.table_name, columns.column_name, columns.data_type, columns.udt_name FROM information_schema.tables AS tables JOIN information_schema.columns AS columns ON tables.table_name = columns.table_name WHERE tables.table_type = 'BASE TABLE' AND tables.table_schema NOT IN ('pg_catalog', 'information_schema')";
$data = json_decode(collect(DB::select($query)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment