Run raw SQL in migration

前端 未结 2 1484
暗喜
暗喜 2020-12-14 00:42

I was trying with whatever syntax and can\'t think how can I write this correctly:

Schema::table(\'users\', function(Blueprint $table){
    $sql = <<&l         


        
2条回答
  •  暖寄归人
    2020-12-14 00:54

    Use back-ticks instead of single quotes to escape identifiers in MySQL:

    alter table `users` modify `age` datetime
    

    In this particular case you can omit escaping at all:

    alter table users modify age datetime
    

提交回复
热议问题