All the tables in the database created by a rails application seem to have created_at and updated_at columns. What creates these? Are they optional, or does something internal rely on them?
The timestamp when the record was first created in the database. updated_at. The timestamp of the most recent change to any of the data stored in the table.
The CREATE TABLE statement is used to create a new table in a database.
They are created by default when you run the ActiveRecord migration for a model. ActiveRecord automatically populates/updates them when you create or update a model instance (and thus the underlying database table row) respectively.
You can remove the columns by removing the t.timestamps
line from within the model migration file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With