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
Match a String Against Multiple Patterns
Find Number of Months Between Two Dates in Ruby on Rails
How to Use "Rvm --Default" on Macosx
Unable to Obtain Stable Firefox Connection in 60 Seconds (127.0.0.1:7055)
Undefined Method Attr_Accessible
Why Isn't Current Directory on My Ruby Path
Convert Array of 2-Element Arrays into a Hash, Where Duplicate Keys Append Additional Values
How to Run Rake Tasks Within a Ruby Script
In Ruby, Is There an Array Method That Combines 'Select' and 'Map'
Getaddrinfo: Nodename Nor Servname Provided, or Not Known
Rails Each Loop Insert Tag Every 6 Items
Checking If a Variable Is Defined in Sass
Installing Jekyll Without Root
Getting Fields_For and Accepts_Nested_Attributes_For to Work With a Belongs_To Relationship