How may i Switch my Rails App from Mysql to Sql Se

2019-07-30 16:07发布

How may i change my database from MYSQL to Sql server in Rails 4

 What configuration i may specify in database.yml file and what all gem i may need to add for that.Please help. :)

1条回答
别忘想泡老子
2楼-- · 2019-07-30 16:26

Add this to gemfile

gem install mysql2

And this to database.yml

default: &default
  adapter: mysql2
  encoding: utf8
  host: 127.0.0.1
  port: 3306

development:
  <<: *default
  database: development_db_name
  username: YOUR_USER_NAME
  password: YOUR_PASSWORD 

test:
  <<: *default
  database: test_db_name
  username: YOUR_USER_NAME
  password: YOUR_PASSWORD

production:
  <<: *default
  database: production_db_name
  username: YOUR_USER_NAME
  password: YOUR_PASSWORD
查看更多
登录 后发表回答