Add timestamps and dropTimestamps support in table properties

This is probably something people will enjoy having in the database manager.

timestampstable.timestamps([useTimestamps], [defaultToNow])

Adds created_at and updated_at columns on the database, setting each to datetime types. When true is passed as the first argument a timestamp type is used instead. Both colums default to being not null and using the current timestamp when true is passed as the second argument. Note that on MySQL the .timestamps() only have seconds precision, to get better precision use the .datetime or .timestamp methods directly with precision.

dropTimestampstable.dropTimestamps()

Drops the columns created_at and updated_at from the table, which can be created via timestamps.

image

Community Page
Last updated: