如何在 Laravel 迁移中将类型列从文本更改为时间戳

时间:2021-07-18 10:01:40

标签: laravel laravel-7

我尝试使用doctrine/dbal 包在迁移中将列类型从文本更改为时间戳,但出现以下错误 我的另一种方法是通过 phpmyadmin Let me do this،但它不是 Laravel 的标准方法 我的 Laravel 版本 7

Migrating: 2021_07_18_085741_change_type_text_to_timestamp_in_started_at_column_table_posts

   Error 

  Call to a member function change() on null

  at I:\Laravel tests project\fortest\database\migrations\2021_07_18_085741_change_type_text_to_timestamp_in_started_at_column_table_posts.php:17
    13|      */
    14|     public function up()
    15|     {
    16|         Schema::table('posts', function (Blueprint $table) {
  > 17|             $table->timestamps('started_at')->change();
    18|         });
    19|     }
    20| 
    21|     /**

  1   I:\Laravel tests project\fortest\vendor\laravel\framework\src\Illuminate\Database\Schema\Blueprint.php:88
      ChangeTypeTextToTimestampInStartedAtColumnTablePosts::{closure}(Object(Illuminate\Database\Schema\Blueprint))

  2   I:\Laravel tests project\fortest\vendor\laravel\framework\src\Illuminate\Database\Schema\Builder.php:310
      Illuminate\Database\Schema\Blueprint::__construct("posts", Object(Closure), "")

0 个答案:

没有答案
相关问题