亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

artisantinker 中的 Laravel 數據庫插入錯誤

artisantinker 中的 Laravel 數據庫插入錯誤

PHP
胡子哥哥 2023-09-08 18:21:04
錯誤使用消息 'SQLSTATE[HY000] 照亮/數據庫/QueryException:一般錯誤:1 表配置文件沒有名為標題的列(SQL:插入“配置文件”(“標題”,“描述”,“user_id”,“updated_at”,“ create_at") 值 (asd, 123123, 2, 2020-07-31 10:19:03, 2020-07-31 10:19:03))'這是我在 '$profile -> save();' 時遇到的錯誤 我正在根據以下鏈接學習 Laravel: https://www.youtube.com/watch?v =ImtZ5yENzgE&list=WL&index=45&t=81s這是 2020_07_31_074115_create_profiles_table.php   {       Schema::create('profiles', function (Blueprint $table) {           $table->bigIncrements('id');           $table->unsignedBigInteger('user_id');           $table->string('title')->nullable();           $table->text('description')->nullable();           $table->string('url')->nullable();           $table->timestamps();           $table->index('user_id'); //FK       });   }   /**    * Reverse the migrations.    *    * @return void    */   public function down()   {       Schema::dropIfExists('profiles');   }這是 2014_10_12_000000_create_users_table.php<?phpuse Illuminate\Database\Migrations\Migration;use Illuminate\Database\Schema\Blueprint;use Illuminate\Support\Facades\Schema;class CreateUsersTable extends Migration{    /**     * Run the migrations.     *     * @return void     */    public function up()    {        Schema::create('users', function (Blueprint $table) {            $table->bigIncrements('id');            $table->string('name');            $table->string('email')->unique();            $table->string('username')->unique();            $table->timestamp('email_verified_at')->nullable();            $table->string('password');            $table->rememberToken();            $table->timestamps();        });    }    /**     * Reverse the migrations.     *     * @return void     */    public function down()    {        Schema::dropIfExists('users');    }}
查看完整描述

1 回答

?
繁星coding

TA貢獻1797條經驗 獲得超4個贊

如果這是您的本地開發環境,您可以運行:

php artisan migrate:fresh

根據設計,遷移命令對文件中的更改不敏感。它使用文件名來了解它已經運行了哪些遷移以及需要運行哪些遷移。

php artisan migrate如果您編輯了文件,第二次運行將不會產生任何效果。

要進行會改變生產數據庫的更改,您需要進行新的遷移并更改表,而不是編輯舊的遷移文件。


查看完整回答
反對 回復 2023-09-08
  • 1 回答
  • 0 關注
  • 117 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號