Skip to content

Instantly share code, notes, and snippets.

View brlo's full-sized avatar
🦎
...

Rodion V brlo

🦎
...
View GitHub Profile
@brlo
brlo / ar_migrate.rb
Created April 8, 2016 16:25 — forked from icyleaf/ar_migrate.rb
ActiveRecord type of integer (tinyint, smallint, mediumint, int, bigint)
# activerecord-3.0.0/lib/active_record/connection_adapters/mysql_adapter.rb
# Maps logical Rails types to MySQL-specific data types.
def type_to_sql(type, limit = nil, precision = nil, scale = nil)
return super unless type.to_s == 'integer'
case limit
when 1; 'tinyint'
when 2; 'smallint'
when 3; 'mediumint'
when nil, 4, 11; 'int(11)' # compatibility with MySQL default
@brlo
brlo / mysql_watcher.sh
Last active February 4, 2019 10:44
Watching or killing long mysql queries #mysql #docker
#!/bin/bash
# queries which executes >= THIS VAR will be killed
KILL_TIME=0
# settings for mysql connection
DB_LOGIN_PATH="local"
# You can create login-path like this:
# mysql_config_editor set --login-path=local --host=0.0.0.0 --user=root --password