Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3977804
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:58:02+00:00 2026-05-20T04:58:02+00:00

In my database migration file I inserted the line: t.timestamps Two columns, as I

  • 0

In my database migration file I inserted the line:

t.timestamps

Two columns, as I expected, were created: “updated_at” and “created_at”. However, their type is “datetime” and not “timestamp”.

I am using MySQL and the “timestamp” type, as I understand, is designed exactly for such cases, as it uses less space and is independent of timezone.

So, is there any reason, why Rails 3 uses “datetime” and not “timestamp”? Should I try to fix that? If yes, is there any way to do this besides not using “t.timestamps” and defining “updated_at” and “created_at” columns separately every time for each new table?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T04:58:03+00:00Added an answer on May 20, 2026 at 4:58 am

    From memory, the mysql timestamp column type behaves similar to updated_at in that it is updated with the current time whenever the record is updated.

    While this is useful for the updated_at column, this is not the desired behaviour for created_at.

    In addition, Rails handles the timezone as specified in your app’s settings (should would normally be set to UTC), so using mysql’s time may be inconsistent with other datetime records.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After generating / writing / running a Rails database migration, should the migration file
Using Grails database-migration I have a table in production defined like so: +--------------+------------+------+-----+---------+----------------+ |
I am working on database migration tool in java. The tool is copying database
I need a database migration framework for SQL Server, capable of managing both schema
I'm working on database migration program and I'm trying to migrate one database to
How do I access the contents of database.yml inside an ActiveRecord migration? Specifically, I
I have created a new application using Entity Framework 4.3 database migrations. The migrations
We have around 100 database migration files. Many of them make schema changes which
I removed several tables in my Rails database by running rails generate migration RemoveObjects
I have an existing database structure created outside or Rails. I've edited one of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.