Skip to content

Instantly share code, notes, and snippets.

@thedevsaddam
Forked from scrubmx/mysql_dump_migration.php
Created August 30, 2016 06:13
Show Gist options
  • Save thedevsaddam/b93b42a61831eef16ca4f25de271fadc to your computer and use it in GitHub Desktop.
Save thedevsaddam/b93b42a61831eef16ca4f25de271fadc 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