What is the MySQL datatype SET equivalent in Laravel Schema?

前端 未结 6 1866
春和景丽
春和景丽 2020-12-15 10:13

Laravel Schema has a command for ENUM equivalent to the table. What is the SET equivalent to the table?

6条回答
  •  遥遥无期
    2020-12-15 11:08

    My simple once-off solution when you need to create a custom column without creating additional files to describe extended grammar. Here I add my custom type rsvp_statuses into PostgresGrammar:

        public function up()
        {
            DB::connection()->setSchemaGrammar(new class extends PostgresGrammar {
                protected function typeRsvp_statuses(\Illuminate\Support\Fluent $column)
                {
                    return 'rsvp_statuses';
                }
            });
    
            Schema::create('mytable', function (Blueprint $table) {
                $table->bigIncrements('id');
                //...
                $table->addColumn('rsvp_statuses', 'status');
                $table->timestamps();
            });
        }
    

提交回复
热议问题