Skip to content

Instantly share code, notes, and snippets.

@richdownie
Created March 13, 2014 15:47
Show Gist options
  • Save richdownie/9530956 to your computer and use it in GitHub Desktop.
Save richdownie/9530956 to your computer and use it in GitHub Desktop.
namespace :insert_users do
desc "Directly INSERT QA Users into the database"
task :qa do
gateway = Net::SSH::Gateway.new('secret','secret',:password => "secret")
port = gateway.open('secret', secret, secret)
class CLIENT_USER < ActiveRecord::Base
self.table_name = 'CLIENT_USER'
establish_connection(:adapter=>"secret",:host=>"secret",:username => "secret",:password => "secret",:database=>"secret",:port=>secret)
end
fk_constraints_off = "SET foreign_key_checks = 0"
fk_constraints_on = "SET foreign_key_checks = 1"
puts CLIENT_USER.connection.execute(fk_constraints_off);
password = Crypt3.crypt('password')
CLIENT_USER.create(:FIRST_NAME => "BOOM", :LAST_NAME => "BOOM", :CLIENT_ID => "chipotle", :EMAIL => "[email protected]", :PASSWORD => "#{password}", :PHONE => "5554443333",:ENTERED_BY => 9999, :ENTERED_TIME => '2014-03-12 11:09:59', :FORGOT_PASSWORD_TIME => '1969-12-31 18:00:00')
client['Automation'].send('Cyborg', "#{CLIENT_USER.last.to_yaml.inspect}", :color => 'green')
# CLIENT_USER.last.destroy
puts CLIENT_USER.connection.execute(fk_constraints_on);
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment