Php postgresql的Laravel blueprint inet类型
我需要在我的项目(laravel)中进行迁移以创建一些新表,其中一个表必须具有Php postgresql的Laravel blueprint inet类型,php,laravel,blueprint,Php,Laravel,Blueprint,我需要在我的项目(laravel)中进行迁移以创建一些新表,其中一个表必须具有inet类型的列,因此我执行了以下操作: Schema::create('host_servers', static function (Blueprint $t) { //... $t->addColumn('inet', 'ip'); //... }); 但是当我运行php artisan migrate时,它会说: BadMethodCallException:Method\Dat
inet
类型的列,因此我执行了以下操作:
Schema::create('host_servers', static function (Blueprint $t) {
//...
$t->addColumn('inet', 'ip');
//...
});
但是当我运行php artisan migrate时,它会说:
BadMethodCallException:Method\Database\Schema\Grammars\PostgresGrammar::typeInet不存在。
根据评论,答案是:
$t->ipAddress('column_name');
尝试使用$t->ipAddress('ip')代码>,它应该为您创建inet类型的列