DEV Community

Cover image for Ways to declare unsigned columns in the Laravel migrations
Vishnu Damwala
Vishnu Damwala

Posted on โ€ข Originally published at meshworld.in

3 2

Ways to declare unsigned columns in the Laravel migrations

Laravel developers love the way it handles relationships between tables by just associating models with each other.

The column which defines the relationship between tables must be of unsigned type.

In this tutorial, we'll see how we can declare columns as unsigned in different ways in Laravel.

You need to import Illuminate\Database\Schema namespace with use keyword.

Using unsignedInteger column types

  $table->unsignedInteger('user_id');

Using only integer column type

  $table->integer('user_id', false, true);

Using integer column type with unsigned column modifier

  $table->integer('user_id')->unsigned();

Read the complete post on our site MeshWorld - Ways to declare unsigned columns in the Laravel migrations

For more, you can check the official documentation for migrations creating-columns page.

Read others post on our site MeshWorld

Happy coding

With โค๏ธ from ๐Ÿ‡ฎ๐Ÿ‡ณ

Image of Docusign

๐Ÿ› ๏ธ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

๐Ÿ‘‹ Kindness is contagious

Please leave a โค๏ธ or a friendly comment on this post if you found it helpful!

Okay