Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- task :migrate_accounts_schema => [:environment] do |t|
- users = User.find :all, :conditions => ["state = 2"], :order => "id asc"
- users.each do |user|
- if user.state == 2
- ActiveRecord::Base.establish_connection(
- :adapter => "postgresql",
- :host => user.database_host,
- :port => user.database_port,
- :username => user.subdomain,
- :password => "#{user.database_password}",
- :database => user.database_name
- )
- Rake::Task["db:migrate"].invoke
- end
- end
- end
- ** Invoke app:migrate_accounts_schema (first_time)
- ** Invoke environment (first_time)
- ** Execute environment
- ** Execute app:migrate_accounts_schema
- ** Invoke db:migrate (first_time)
- ** Invoke environment
- ** Execute db:migrate
- ** Invoke db:schema:dump (first_time)
- ** Invoke environment
- ** Execute db:schema:dump
- ** Invoke db:migrate
- # db/seed.rb
- Rake::Task['catalog:destroy'].invoke
- files = Dir.glob("private/catalog/*").sort
- files.each do |file|
- next unless File.extname(file) == '.xlsx'
- puts file.split('/').last
- Rake::Task['catalog:upload'].invoke(file)
- Rake::Task['catalog:upload'].reenable
- puts
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement