39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
require __DIR__ . '/../vendor/autoload.php';
|
|
$app = require_once __DIR__ . '/../bootstrap/app.php';
|
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
|
$kernel->bootstrap();
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
$conn = DB::connection('gescon_import');
|
|
$driver = $conn->getDriverName();
|
|
echo "Driver: $driver\n";
|
|
|
|
$tables = [];
|
|
if ($driver === 'sqlite') {
|
|
$rows = $conn->select("SELECT name FROM sqlite_master WHERE type='table'");
|
|
foreach ($rows as $r) {
|
|
$tables[] = $r->name;
|
|
}
|
|
} else {
|
|
$rows = $conn->select("SHOW TABLES");
|
|
foreach ($rows as $r) {
|
|
$tables[] = array_values((array)$r)[0];
|
|
}
|
|
}
|
|
|
|
$list = [];
|
|
foreach ($tables as $name) {
|
|
if (stripos($name, 'rate') !== false || stripos($name, 'prev') !== false) {
|
|
$list[] = $name;
|
|
}
|
|
}
|
|
echo "gescon_import tables matching 'rate' or 'prev': " . implode(', ', $list) . "\n";
|
|
|
|
foreach ($list as $tbl) {
|
|
echo "\nColumns for table '$tbl':\n";
|
|
print_r(Schema::connection('gescon_import')->getColumnListing($tbl));
|
|
}
|