我是Laravel的新手,我正在关注Laravel Documentations以及一些教程视频.但是,我在我的本地CMD提示符中运行这个PHP artisan迁移代码,而不是在PHPmyadmin中创建数据库表.在stackoverflow中还有其他几个与此相关的类似主题,但没有解决我的问题.请不要标记此副本.
好吧,它是这样的.我运行这段代码
- PHP artisan make:migration create_student_table --create=student
并在迁移文件夹中创建新文件,如2016_04_08_061507_create_student_table.PHP
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Database\Migrations\Migration;
- class CreateStudentTable extends Migration
- {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('student',function (Blueprint $table) {
- $table->increments('id');
- $table->timestamps();
- $table->string('name',20);
- $table->string('email',255);
- });
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::drop('student');
- }
- }
然后在cmd我运行PHP artisan migrate但它没有创建学生表.相反,它显示此消息
[PDOException] sqlSTATE[42S01]: Base table or view already exists:
1050 Table ‘users’ already exists