Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

I'm writing a migration to make certain columns in a table nullable right now. For the down function, I, of course, want to make those columns not nullable again. I looked through the schema builder docs, but couldn't see a way to do this.

Any help would be appreciated.

1 Answer

0 votes
by (40.7k points)

There was no Laravel native way of altering an existing table column using the schema builder prior to Laravel 5. You need to use raw queries.

However, if you are using Laravel 5 use the below code:

$table->...->nullable(false)->change();

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...