Xethron / migrations-generator

Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.
MIT License
3.32k stars 591 forks source link

Feature Request? !Schema::hasTable #183

Open theWebKeyGuy opened 5 years ago

theWebKeyGuy commented 5 years ago

Hello,

I was not sure if you have a area where I could put in a feature request as I could see this being very helpful including in the project I'm currently working on.

Feature:
I thought it would be cool if we could generate migrations that can auto have this feature in it so that way if I'm generating a migrations for a current project I don't accidentally overwrite databases tables on lets say my production server when I run php artisan migrate.

if (!Schema::hasTable('flights')) {
    Schema::create('flights', function (Blueprint $table) {
      $table->increments('id');
      $table->string('name');
      $table->string('airline');
      $table->timestamps();
    });
} 

The reason this would be useful is for someone like me that is working on a project that wasn't originally done in Laravel but I still need to work with the tables that they originally had from there old system to keep all of there current data. Again I'm sorry if I didn't post this in the right area or something but I just thought this would be really helpful in a lot of peoples cases.

Soul-Killer-Ky commented 4 years ago

I had the same problem