简体   繁体   English

在Ruby on Rails中添加第二个SQLite数据库

[英]Adding a second SQLite db in Ruby on Rails

I have a ROR application with a sqlite3 db. 我有一个带sqlite3 db的ROR应用程序。 I want to create a new database, and I do not want to delete the previous one. 我想创建一个新数据库,并且不想删除前一个数据库。

  1. how I will define a new db in a current project, so as when I run rake db:create referring to the new one? 我将如何在当前项目中定义新的数据库,以便在运行rake db:create时引用新的数据库?

generally what is the process to add a new sqlite db in the existing project? 通常,在现有项目中添加新的sqlite数据库的过程是什么?

Just change database name in database.yml file 只需更改database.yml文件中的数据库名称

development:
  database: 'changed ndb_name'
  ...

Follow the below steps: 请按照以下步骤操作:

  1. change database name in database.yml file 更改database.yml文件中的数据库名称
  2. rake db:create
  3. rake db:migrate

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM