Skip to content

Instantly share code, notes, and snippets.

@abr4xas
Forked from scrubmx/mysql_dump_migration.php
Created August 18, 2017 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abr4xas/e1349b95ce4d2de8bac42058b5916ce4 to your computer and use it in GitHub Desktop.
Save abr4xas/e1349b95ce4d2de8bac42058b5916ce4 to your computer and use it in GitHub Desktop.
Import mysql dump as laravel migration
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePostalCodesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$file = realpath(__DIR__.'/../catalogs/codigos_postales.sql');
DB::unprepared( file_get_contents($file) );
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('codigos_postales');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment