在rails的config/database.yml中有一段注釋:
# 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.
我沒有注意,不小心將三種環境的database設成一樣了,昨天運行了一下:rake --trace,就將已經上線的系統資料全部清除了,真是'慘!慘!慘!'。
我通常會用到sqlite、mysql、oracle,一般database.yml設置如下:
development_defaults: &development_defaults
<% if RUBY_PLATFORM =~ /java/ %>
adapter: jdbc
driver: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost/rged_development
database: myapp_development
username: root
password:
host: localhost
<% else %>
adapter: mysql
database: myapp_development
username: root
password:
host: localhost
#socket: /opt/local/var/run/mysql5/mysqld.sock
<% end %>
test_defaults: &test_defaults
<% if RUBY_PLATFORM =~ /java/ %>
adapter: jdbc
driver: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost/rged_test
database: myapp_test
username: root
password:
host: localhost
<% else %>
adapter: mysql
database: myapp_test
username: root
password:
host: localhost
#socket: /opt/local/var/run/mysql5/mysqld.sock
<% end %>
production_defaults: &production_defaults
<% if RUBY_PLATFORM =~ /java/ %>
adapter: jdbc
driver: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost/rged_production
database: myapp_production
username: root
password:
host: localhost
<% else %>
adapter: mysql
database: myapp_production
username: root
password:
host: localhost
#socket: /opt/local/var/run/mysql5/mysqld.sock
<% end %>
sqlite_db: &sqlite_db
adapter: sqlite3
timeout: 5000
oracle_db: &oracle_db
adapter: oracle
database: 60200
ora_dms: &ora_dms
<<: *oracle_db
username: dms
password: practice
development:
<<: *development_defaults
test:
<<: *sqlite_db
database: db/dms_test.db
production:
<<: *ora_dms
分享到:
相关推荐
安装 go get -u github.com/dovadi/dbconfig例子在settings.json中需要定义数据库yaml文件的位置和应用环境 { "database_file" : "/Users/dovadi/rails/blog/config/database.yml" "environment" : "development"} ...
基本应用基本的Rails 4应用程序。 具有Facebook登录功能的用户和管理系统。 它对Heroku不可安装。 该视图是使用实现的。 这是。... 创建您的config/database.yml ,创建数据库并运行迁移。 为了使Faceboo
使用有效的凭证设置config/database.yml到您的本地postgres服务器。 然后运行: rake db:create db:migrate db:seed 执照 此应用程序已获得MIT-LICENSE的许可,请参阅文件MIT-LICENSE以获得更多信息。 版权 由...
首先在宿主机创建并修改配置相关文件 /path/to/config/application.yml , 示例文件[application-example.yml](./src/main/resources/application-example.yml) 主要修改: ``` guns.file-upload-path spring....
cp config/database.yml{.mysql,} # PostgreSQL cp config/database.yml{.postgresql,} cp config/gitlab.yml{.sample,} cp config/pusher.yml{.sample,} vi config/database.yml vi config/gitlab.yml vi config/...
将database.yml文件从config/sample/database.yml复制到config/database.yml : cp config/sample/database.yml config/database.yml使用以下命令创建数据库: createdb blueprint_development迁移数据库: rake db...
梯子 阶梯锦标赛排名网站。... 从示例文件config/database.yml.example创建config/database.yml config/database.yml.example 。 设置数据库。 不要从头开始运行迁移,否则将失败。 bundle exec rake db:se
) 假设您正在一个小团队中使用Rails应用程序,您有几个环境,并且您有一个config/database.yml ,其中每个阶段都有一些不同的秘密。 您想在源代码控制之外维护这些机密,但手动在服务器上放置config/database.yml会...
对于SQLite3,请cp config/database.yml.sqlite3 config/database.yml 。 对于MySQL,请cp config/database.yml.mysql config/database.yml 。 更新文件以匹配您的配置。 通过运行rake secret设置config/secrets....
cp config/database.sample.yml config/database.yml cp config/application.sample.yml config/application.yml bundle exec rake db:create db:migrate bundle exec rails server 贡献 分叉( ) 创建功能分支( ...
安装 先决条件 设置步骤需要在系统上安装以下工具。 rbenv( ) Ruby Rails PostgreSQL( ) ...cp config/database.yml.sample config/database.yml 4.创建和设置数据库 运行以下命令来创建和设置数据
欢迎使用iRails 基于Rails 4的项目的简单模板入门$ git clone git://github.com/droidlabs/irails.git myapp $ cd ./myapp $ cp config/database.yml.example config/database.yml 配置您的config / database.yml $ ...
设置将config/database.yml.example文件复制到config/database.yml : $ cp config/database.yml.example config/database.yml现在编辑您的config/database.yml使其符合您的开发机器要求,因此添加您的数据库用户名...
config/database.yml config/guisso.yml config/hub.yml 配置Nuntium Nuntium设置位于config/nuntium.yml 。 必须通过以下方式配置与Pollit实例关联的Nuntium应用程序: 应用程序名称: config/nuntium.yml中...
梯子 Fastladder( )是想要...$ cp config/database.yml.sqlite3 config/database.yml $ bundle install # For MySQL $ cp config/database.yml.mysql config/database.yml $ bundle install # For PostgreSQL $ c
$捆绑安装$ cp ./config/database.yml.sample ./config/database.yml $ cp ./config/secrets.yml.sample ./config/secrets.yml 要更改默认密钥,请运行以下命令,复制生成的密钥并修改secrets.yml文件。 您需要...
域注册表 完整堆栈顶级域(TLD)管理。 文献资料 安装 注册表应用 基于Rails 4安装的注册表...cp config/database.yml.sample config/database.yml # and edit it bundle exec rake db:setup:all # for production,
入门: 从github克隆您的应用程序后: 将config / database.yml.example复制到config / database.yml 将config / application.yml.example复制到config / application.yml 在config / database.yml中设置数据库详细...
config/examples/database.yml.sqlite config/database.yml 如果您的环境是开发环境,那么默认的application.yml配置将适用于您。 如果您需要在其他环境中运行,请务必编辑文件并设置值。 领班 在开发过程中,您可以...
链接转储 简单的链接转储Sinatra应用程序(JSON API +基本Web视图) ...开发入门 rvm install . ...cp config/database.yml.example config/database.yml APP_DIR=$PWD CONSOLE_LOG=1 bundle exec puma