title: Laravel : Migrations & Seeding for production data
body: <p>My application needs a pre registered data set to work. So i need to insert them in the database when i set up the application.</p>
  
  <p><a href="http://laravel.com/" rel="noreferrer">Laravel</a> propose two mechanisms :</p>
  
  <ul>
  <li><a href="http://laravel.com/docs/migrations" rel="noreferrer">Database migrations</a> : <em>"They allow a team to modify the database schema and stay up to date on the current schema state."</em></li>
  <li><a href="http://laravel.com/docs/migrations#database-seeding" rel="noreferrer">Database seeding</a> : <em>"Laravel also includes a simple way to seed your database with test data using seed classes."</em></li>
  </ul>
  
  <p>When I read this description, none of these solutions seems to be adapted.</p>
  
  <p>A similar question has been <a href="https://stackoverflow.com/questions/18950438/laravel-db-seeds-test-data-v-sample-data">asked on stackoverflow</a> and <a href="https://stackoverflow.com/a/18951089/1594933">answered</a>. The answer proposes to use the a database seeder to populate the database by detecting the current environment :</p>
  
  <pre><code>&lt;?php
  
  class DatabaseSeeder extends Seeder {
  
      public function run()
      {
              Eloquent::unguard();
  
              if (App::environment() === 'production')
              {
                  $this-&gt;call('ProductionSeeder');
              }
              else
              {
                  $this-&gt;call('StagingSeeder');
              }
      }
  
  }
  </code></pre>
  
  <p>Of course, this solution works. But i am not sure that it is the right way to do this, because by inserting data using seeders you are losing all the advantages provided by the migration mechanism (database upgrate, rollback...)</p>
  
  <p>I want to know what is the best practice in this case.</p>