我正在使用 Laravel 8。我正在尝试创建一个新表,但该表在数据库中不存在,并且没有任何其他同名表。我进行了迁移,这是迁移代码:
\n<?php\n\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n\nclass CreateCertificateTable extends Migration\n{\n /**\n * Run the migrations.\n *\n * @return void\n */\n public function up()\n {\n Schema::table('certificate', function (Blueprint $table) {\n $table->id();\n $table->unsignedBigInteger('user_id');\n $table->unsignedBigInteger('vac_id');\n $table->time('last_shot_date');\n $table->timestamps();\n\n $table->foreign('user_id')->references('id')->on('users');\n $table->foreign('vac_id')->references('id')->on('vaccination');\n });\n }\n\n /**\n * Reverse the migrations.\n *\n * @return void\n */\n public function down()\n {\n Schema::table('certificate', function (Blueprint $table) {\n //\n });\n }\n}\n\nRun Code Online (Sandbox Code Playgroud)\n做完之后
\nphp artisan migrate\nRun Code Online (Sandbox Code Playgroud)\n这是我收到的完整错误消息:
\n Illuminate\\Database\\QueryException\n\n SQLSTATE[42S02]: Base table or view not found: 1146 Table …Run Code Online (Sandbox Code Playgroud)