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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.timestampsline from within the model migration file.