jeudi 3 mai 2018

Laravel create table with raw string

How can I create a new table in laravel 5.5 with a raw DB string?

$createTableSqlString =
  "CREATE TABLE $newTableName (
      product_id INT(11) NOT NULL AUTO_INCREMENT,
      ...
    )
    COLLATE='utf8_general_ci'
    ENGINE=InnoDB
    AUTO_INCREMENT=1;";

I know there is a Illuminate\Support\Facades\Schema for making a new table,

Schema::connection('mysqlInvsys')->create(...);

But how should I define or give it the raw string DB::raw($createTableSqlString) ? I did not find any example in the official doc.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire