0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

laravelで tinyInteger の auto increments のカラムを作る

Last updated at Posted at 2017-02-27

Laravel 5.4 にて確認。

下記メソッドで auto increments のカラムを作ることができます。

$table->increments('id');
$table->mediumIncrements('id');
$table->smallIncrements('id');

tinyint ではこのような記載になります。(コメントにてご教授ありがとうございます)

$table->tinyInteger('id', true, true);

laravel4 では下記のように書く必要があります。5.4でも下記で動作確認できました。ただ上記のほうがスマートです。

$table->tinyInteger('id')->unsigned()->autoIncrement();

参考
http://stackoverflow.com/questions/19711783/is-it-possible-add-tinyinteger-or-smallinteger-to-increments-on-laravel-orm

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?