vimx
vimx

Reputation: 138

ActiveRecord Migration to Postgresql

Can I create an ActiveRecord Migration without created_at and updated_at attributes?

I am using PostgreSQL 9.3 and Ruby on Rails 4.2.
How can I do it? I have been searching but nothing helped me.

Upvotes: 0

Views: 35

Answers (1)

Prakash Murthy
Prakash Murthy

Reputation: 13057

Yes. You can.

But you should probably include them as these special columns are useful.

See http://edgeguides.rubyonrails.org/active_record_migrations.html for how these columns are included.

Specifying t.timestamps null: false in the migration file will include the two special columns - created_at and updated_at. These special columns are automatically managed by Active Record if they exist.

So if you want to deliberately exclude these columns, remove the t.timestamps null: false line after the migration is generated.

Upvotes: 1

Related Questions