Tsvector of postgres in Laravel 5.3

1

I need to create a tsvector field ( link ) of postgres in my table > Documents I already searched in several places how to do it but I can not find it.

Schema::create('documentos', function (Blueprint $table) {
        $table->increments('id');
        $table->string('nombre');
        $table->string('image');
        $table->string('minimagen');
        $table->string('fecha');
        $table->longText('bytes');
        //$table->string('mytsvector');
        $table->integer('user_id')->unsigned();
        $table->foreign('user_id')->references('id')->on('users');
        $table->timestamps();
    });
    
asked by Shassain 23.07.2017 в 04:13
source

1 answer

2

There is no method or function to create this type of field in Laravel through migrations, the only option is using "pure" SQL in it:

Schema::create('documentos', function (Blueprint $table) {
    $table->increments('id');
    $table->string('nombre');
    $table->string('image');
    $table->string('minimagen');
    $table->string('fecha');
    $table->longText('bytes');
    $table->integer('user_id')->unsigned();
    $table->foreign('user_id')->references('id')->on('users');
    $table->timestamps();
});
    DB::statement('ALTER TABLE documentos ADD COLUMN mytsvector tsvector');
    
answered by 23.07.2017 / 04:51
source