Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. 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'."
  2.  
  3.  
  4. #Articles table migration
  5.  
  6. <?php
  7.  
  8. use Illuminate\Database\Schema\Blueprint;
  9. use Illuminate\Database\Migrations\Migration;
  10.  
  11. class CreateArticalesTable extends Migration {
  12.  
  13. /**
  14. * Run the migrations.
  15. *
  16. * @return void
  17. */
  18. public function up()
  19. {
  20. Schema::create('articles', function(Blueprint $table)
  21. {
  22. $table->increments('id');
  23. $table->integer('user_id')->unsigned();
  24. $table->string('title');
  25. $table->text('body');
  26. $table->timestamp('published_at');
  27. $table->timestamps();
  28.  
  29. $table->foreign('user_id')
  30. ->references('id')
  31. ->on('users')
  32. ->onDelete('cascade');
  33.  
  34.  
  35.  
  36. });
  37. }
  38.  
  39. /**
  40. * Reverse the migrations.
  41. *
  42. * @return void
  43. */
  44. public function down()
  45. {
  46. Schema::drop('articles');
  47. }
  48.  
  49. }
  50.  
  51.  
  52.  
  53.  
  54. # Modifications to Migration Table
  55. <?php
  56.  
  57. use Illuminate\Database\Schema\Blueprint;
  58. use Illuminate\Database\Migrations\Migration;
  59.  
  60. class AddExcerptToArticlesTable extends Migration {
  61.  
  62. /**
  63. * Run the migrations.
  64. *
  65. * @return void
  66. */
  67. public function up()
  68. {
  69. Schema::table('articles', function(Blueprint $table)
  70. {
  71. $table->text('excerpt')->nullable();
  72. });
  73. }
  74.  
  75. /**
  76. * Reverse the migrations.
  77. *
  78. * @return void
  79. */
  80. public function down()
  81. {
  82. Schema::table('articles', function(Blueprint $table)
  83. {
  84. //$table->dropColumn('excerpt');
  85. });
  86. }
  87.  
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement