Rails - New Shortcut for Not Null Columns in Migrations
- Categories:
- rails
Rails is introducing a handy new feature in its migration generator: a shortcut for creating not null columns. This enhancement, submitted by David Heinemeier Hansson (DHH) himself, simplifies the process of defining required fields in your database schema.
The New Syntax
Previously, to create a not null column, you’d have to explicitly specify null: false
in your migration. Now, you can use the !
symbol as a shortcut.
This generates the following migration:
Sponsored Links
- Register to Digital Ocean cloud with this link and get $200 credit
- Looking for cheap CDN? Bunny is the answer
- Alternative Cloud besides AWS and Digital Ocean