Rails 3. Creating a Production Database

Rails 3. Creating a production database

You can set the rails env off of the environment variable RAILS_ENV

RAILS_ENV=production bundle exec rake db:create db:schema:load

should work

Rails 3. Creating a production database

You can set the rails env off of the environment variable RAILS_ENV

RAILS_ENV=production bundle exec rake db:create db:schema:load

should work

Create DB in production environment in rails

RAILS_ENV=production rake db:create would create the database for the production environment,

whereas

RAILS_ENV=production rake db:schema:load would create tables and columns within the database according the schema.rb for the production environment.

task :load => [:environment, :load_config] do
ActiveRecord::Tasks::DatabaseTasks.load_schema_current(:ruby, ENV['SCHEMA'])
end

task :create => [:load_config] do
ActiveRecord::Tasks::DatabaseTasks.create_current
end

Take a look at this file for complete info on the topic.



Related Topics



Leave a reply



Submit