Forked from isaqueprofeta/laravel_postgresschema2json.php
Created
April 17, 2020 18:25
-
-
Save beingsane/26b75e5d7ce1e424dc53c4a0ec979156 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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