This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -e 'ファイル名' ]; then | |
# ファイル/フォルダが存在していれば、ファイル/フォルダを削除するなど | |
rm ファイル名 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE テーブル名 ADD INDEX インデックス名(カラム名); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ vim /usr/local/etc/mackerel-agent.conf | |
# ファイルの最下部に追加 | |
# command = "ruby <開発したプラグインのファイル場所>" | |
======================================== | |
[plugin.metrics.hogehoge] | |
command = "/Users/yn-misaki/.rbenv/shims/ruby /Users/yn-misaki/dev/mackerel_plugin/hogehoge.rb" | |
======================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM posts FOR UPDATE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# UserのnameはUNIQ制約がない | |
users = names.uniq.map do |name| | |
User.new(name: name) | |
end | |
# BULK INSERTが挿入する前のIDを取得し、+1する | |
before_id = User.last.try(:id).to_i + 1 | |
# BULK INSERTでデータを挿入 | |
User.import users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app/model/query.rb |
OlderNewer