MySql Error: 1364 Field 'display_name' doesn't have default value

后端 未结 7 1834
伪装坚强ぢ
伪装坚强ぢ 2020-11-28 21:37

I have just switched from a MAMP installation to a native Apache, MySql and PHP installation. I have got everything working, but I have started using my web app in the new e

7条回答
  •  我在风中等你
    2020-11-28 21:41

    Also, I had this issue using Laravel, but fixed by changing my database schema to allow "null" inputs on a table where I plan to collect the information from separate forms:

    public function up()
    {
    
        Schema::create('trip_table', function (Blueprint $table) {
            $table->increments('trip_id')->unsigned();
            $table->time('est_start');
            $table->time('est_end');
            $table->time('act_start')->nullable();
            $table->time('act_end')->nullable();
            $table->date('Trip_Date');
            $table->integer('Starting_Miles')->nullable();
            $table->integer('Ending_Miles')->nullable();
            $table->string('Bus_id')->nullable();
            $table->string('Event');
            $table->string('Desc')->nullable();
            $table->string('Destination');
            $table->string('Departure_location');
            $table->text('Drivers_Comment')->nullable();
            $table->string('Requester')->nullable();
            $table->integer('driver_id')->nullable();
            $table->timestamps();
        });
    
    }
    

    The ->nullable(); Added to the end. This is using Laravel. Hope this helps someone, thanks!

提交回复
热议问题