1

migration file

 public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->longText('content');
            $table->string('short_description');
            $table->unsignedInteger('media_id')->nullable();
            $table->foreign('media_id')->references('id')->on('medias');
            $table->unsignedInteger('creator_id');
            $table->foreign('creator_id')->references('id')->on('users');
            $table->boolean('hide')->default(0);
            $table->timestamps();
        });
    }

after hide column i want to add 'privacy column'

Prathamesh Doke
  • 797
  • 2
  • 16
  • 38
  • you can add it into new migration file – Jodeveloper8 Oct 08 '18 at 14:27
  • Duplicate of : https://stackoverflow.com/questions/20982538/add-sql-table-column-before-or-after-specific-other-column-by-migrations-in-la – Malastas Oct 08 '18 at 14:41
  • 1
    Possible duplicate of [Add sql table column before or after specific other column - by migrations in Laravel 4.1](https://stackoverflow.com/questions/20982538/add-sql-table-column-before-or-after-specific-other-column-by-migrations-in-la) – Tharaka Dilshan Oct 08 '18 at 14:49

1 Answers1

3

Either add it to the migration file or create another migration like this :

 Schema::table('posts', function (Blueprint $table) {
       $table->string('privacy')->after('hide');
    });
Boltz0r
  • 970
  • 5
  • 16