Last active
September 9, 2017 07:34
-
-
Save 3h5a9/5fc1aaacb54b952f9ac64d6ee4a3cfe0 to your computer and use it in GitHub Desktop.
migrate:refresh showing error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Illuminate\Database\Schema\Blueprint; | |
| use Illuminate\Database\Migrations\Migration; | |
| class CreateStudentsTable extends Migration | |
| { | |
| /** | |
| * Run the migrations. | |
| * | |
| * @return void | |
| */ | |
| public function up() | |
| { | |
| Schema::create('students', function (Blueprint $table) { | |
| $table->increments('id'); | |
| $table->string('fname'); | |
| $table->string('mname'); | |
| $table->string('lname'); | |
| $table->string('dob'); | |
| $table->string('gender'); | |
| $table->string('bloodgroup'); | |
| $table->string('bplace'); | |
| $table->string('nationality'); | |
| $table->string('religion'); | |
| $table->mediumText('presentadd'); | |
| $table->mediumText('permanentadd'); | |
| $table->string('city'); | |
| $table->string('ps'); | |
| $table->string('zipcode'); | |
| $table->string('phone'); | |
| $table->string('mobile'); | |
| $table->string('email')->unique(); | |
| $table->timestamps(); | |
| }); | |
| } | |
| /** | |
| * Reverse the migrations. | |
| * | |
| * @return void | |
| */ | |
| public function down() | |
| { | |
| Schema::drop('students'); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Illuminate\Database\Schema\Blueprint; | |
| use Illuminate\Database\Migrations\Migration; | |
| class AddRcsToStudentsTable extends Migration | |
| { | |
| /** | |
| * Run the migrations. | |
| * | |
| * @return void | |
| */ | |
| public function up() | |
| { | |
| Schema::table('students', function ($table) { | |
| $table->string('roll')->unique()->after('email'); | |
| $table->string('class')->after('roll'); | |
| $table->string('section')->after('class'); | |
| }); | |
| } | |
| /** | |
| * Reverse the migrations. | |
| * | |
| * @return void | |
| */ | |
| public function down() | |
| { | |
| Schema::table('users', function ($table) { | |
| $table->dropColumn('roll'); | |
| $table->dropColumn('class'); | |
| $table->dropColumn('section'); | |
| }); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The Following errors are showing after php artisan:reset or php artisan:refresh or php artisan:rollback command | |
| [Illuminate\Database\QueryException] | |
| SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'roll'; check that column/key exists (SQL: alter table `users` drop `roll`) | |
| [PDOException] | |
| SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'roll'; check that column/key exists |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error is Schema::table('students', function ($table)
Schema::table('users', function ($table) { $table->string('roll')->unique()->after('email'); $table->string('class')->after('roll'); $table->string('section')->after('class'); });