Skip to content

Commit

Permalink
Remove OIDS das tabelas do banco de dados
Browse files Browse the repository at this point in the history
  • Loading branch information
edersoares committed Mar 17, 2021
1 parent 0937d4f commit b68a247
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions database/migrations/2021_01_20_000000_remove_oids.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class RemoveOids extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$tables = DB::select(
"select schemaname || '.' || tablename as table_name from pg_tables WHERE schemaname <> 'pg_catalog' AND schemaname <> 'information_schema';"
);

foreach ($tables as $table) {
DB::unprepared("alter table {$table->table_name} SET WITHOUT oids;");
}
}
}

0 comments on commit b68a247

Please sign in to comment.