【问题标题】:Laravel blueprint inet type for postgresql用于 postgresql 的 Laravel 蓝图 inet 类型
【发布时间】:2020-06-30 05:49:46
【问题描述】:

我需要在我的项目 (laravel) 中进行迁移以创建一些新表,其中一个表必须有一个 inet 类型的列,所以我这样做了:

Schema::create('host_servers', static function (Blueprint $t) {
    //...
    $t->addColumn('inet', 'ip');
    //...
});

但是当我运行php artisan migrate 时,它会说:

BadMethodCallException : Method Illuminate\Database\Schema\Grammars\PostgresGrammar::typeInet does not exist.

【问题讨论】:

  • 尝试使用$t->ipAddress('ip');,它应该会为你创建一个inet类型的列

标签: php laravel blueprint


【解决方案1】:

根据@Remul的评论,答案是ipAddress

$t->ipAddress('column_name');

【讨论】:

    猜你喜欢
    • 2013-11-29
    • 1970-01-01
    • 1970-01-01
    • 2014-05-11
    • 1970-01-01
    • 2018-12-04
    • 1970-01-01
    • 1970-01-01
    • 2017-06-25
    相关资源
    最近更新 更多