Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I have created a migration table and forgot to add excerpts field in the table so I created a new migration when I do php artisan migrate:reset it is giving me error like "There is no column with name 'excerpt' on table 'articles'."
- #Articles table migration
- <?php
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Database\Migrations\Migration;
- class CreateArticalesTable extends Migration {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('articles', function(Blueprint $table)
- {
- $table->increments('id');
- $table->integer('user_id')->unsigned();
- $table->string('title');
- $table->text('body');
- $table->timestamp('published_at');
- $table->timestamps();
- $table->foreign('user_id')
- ->references('id')
- ->on('users')
- ->onDelete('cascade');
- });
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::drop('articles');
- }
- }
- # Modifications to Migration Table
- <?php
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Database\Migrations\Migration;
- class AddExcerptToArticlesTable extends Migration {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::table('articles', function(Blueprint $table)
- {
- $table->text('excerpt')->nullable();
- });
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::table('articles', function(Blueprint $table)
- {
- //$table->dropColumn('excerpt');
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement