Skip to content

Instantly share code, notes, and snippets.

@KenshoFujisaki
Created April 20, 2015 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KenshoFujisaki/8d74e62a9f380a363f76 to your computer and use it in GitHub Desktop.
Save KenshoFujisaki/8d74e62a9f380a363f76 to your computer and use it in GitHub Desktop.
DBマイグレーション状況確認(マイグレーション済/未のファイル取得)
# cd [RAILS_ROOT]
db_name="db_name"
db_user="db_user"
db_pass="db_pass"
diff -U10000 \
<(ls db/migrate/ | sort | ruby -nle 'print $_.split("_").first') \
<(mysql -u${db_user} -p${db_pass} -D${db_name} -e"select * from schema_migrations;")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment