我正在使用导轨 5.2.3
这是我的命令行
RAILS_ENV=development bundle exec rake db:drop
我原以为只有一个开发数据库被删除了。但是我得到了这两个dbs掉线了。我错过了什么?
Dropped database 'db/development.sqlite3'
Dropped database 'db/test.sqlite3'
数据库.yml
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
谢谢你的帮助!
一个已知问题是,当您为development
环境运行 db 任务时,它们也会为test
envrionemnt运行。
您可以在以下 Rails github reop 上检查此问题
https://github.com/rails/rails/issues/27299
作为一种解决方法,您可以使用以下方法:
https://github.com/ioquatix/activerecord-migrations
它解决了其中一些问题
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句