Custom Exposure

SET PASSWORD FOR 'bob'@'%.example.org' = PASSWORD('cleartext password');

Custom Exposure

Count number of records in array: db.data_records.count( { dataset_id: { $in: [ 2509, 2224, 2128, 2145, 2472, 2249 ] } } ) Count number of records...

ActiveRecord::Schema.define do <> end

thegeekstuff.com

backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql

Custom Exposure

SELECT table_schema 'DB Name', round(Sum(data_length + index_length) / 1024 / 1024, 1) 'DB size in MB' FROM information_schema.tables...

codedecoder.wordpress.com

bundle exec sidekiq -e staging -d -L log/sidekiq.log sidekiq -h -c, –concurrency INT processor threads to use -d, –daemon Daemonize...

wikis.oracle.com

mysql>CREATE DATABASE memcachedSample; mysql>CREATE USER 'web20'@'localhost' IDENTIFIED BY 'web20'; mysql>GRANT ALL PRIVILEGES ON memcachedSample.* TO 'web20...

Custom Exposure

drop index index_name on table_name

gist.github.com

c = ActiveRecord::Base.connection c.tables.collect do |t| columns = c.columns(t).collect(&:name).select {|x| x.ends_with?("_id" || x.ends_with("_type"))}

Custom Exposure

SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = "databaseName" AND TABLE_NAME = "tableName" alter table tablename auto_increment = newvalue

Custom Exposure

SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB",

Best results in other decks

Short reference on how to quickly debug the vanilla Rails job adapters. Queue Adapters by Environment Environment Adapter

Sometimes you have a maintenance script where you want to iterate over all ActiveRecord models. Rails provides this out of...

Search in all decks