是否可能添加tinyInteger或smallInteger来增加laravel ORM? [英] Is it possible add tinyInteger or smallInteger to increments on laravel ORM?
问题描述
可以将该代码或类似的内容添加到 laravel\Illuminate\Database\Schema\Blueprint 中以与迁移一起使用
Is possible to add that code or something like that to laravel\Illuminate\Database\Schema\Blueprint to use with migrations?
public function incrementsTiny($column)
{
return $this->unsignedTinyInteger($column, true);
}
public function incrementsSmall($column)
{
return $this->unsignedSmallInteger($column, true);
}
场景:一些不增长并具有一些有用信息的临时表或者只是没有超过100行的小表,需要一些罕见的更新(添加或更改)。但是可以添加到框架中?它的共同之处在于有很多信息,但有时候它们没有大量的数据。
scenario: some temp table that don't grow high and have some useful information or just small table that do not have more than 100 lines and need some rare update (add or just change). But it is possible to add to the framework? Its common to have a lot information, but sometimes sometables dont have a lot of data.
因为增量只有整数或bigInteger的选项
Because for increments just have the option for integer or bigInteger
推荐答案
您可以使用以下内容:
$table->tinyInteger('id')->unsigned()->autoIncrement();
这篇关于是否可能添加tinyInteger或smallInteger来增加laravel ORM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!