Rails Migration: determining what is being used as a database

I am trying to set a value autoincrement

for a Sqlite database I am currently using. I will switch to Postgresql in the future because I will be deploying to heroku and therefore would like Postgresql to be local for development.

Until then, I am using Sqlite. Is there a way to write a migration so that it knows which database provider I'm using, so that I have two separate statements execute

to install autoincement

?

+3


source to share


1 answer


Try to call connection.adapter_name in your migration. It should return either "PostgreSQL" or "SQLite".



0


source







All Articles