Laravel not nullable timestamp without a default value

I ran into the following question today:

Is there no way to create a timestamp as not null with no default using #laravel migrations? I could get it to work making `shown_at` nullable, which… ok… but why? I’m OK w/ `created_at` using current but `shown_at` should always have a value. [1]

For MySQL there is no easy way to do it – you should switch to a dateTime or dateTimeTz column.

But if you’re really keen on using timestamp, one workaround, although not elegant, is:

ALTER TABLE `table_name` MODIFY COLUMN `column_name` TIMESTAMP NOT NULL DEFAULT 0;
ALTER TABLE `table_name` ALTER  COLUMN `column_name` DROP DEFAULT;

The proper way would be by changing the MySQL default configuration value for explicit_defaults_for_timestamp[2].