Last active
February 19, 2020 16:45
-
-
Save nilbus/dffbb5ad3e4ba69e5096716622d5e237 to your computer and use it in GitHub Desktop.
Count the number of migrations per repo that modify existing schema structure
This file contains hidden or 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
# make a temp directory for each repo to examine | |
mkdir doximity doc-news activities | |
# copy in migrations from 2019 | |
for dir in *; do cp ~/work/$dir/db/migrate/2019* $dir/; done | |
# remove migration reversal code to exclude from search | |
sed -i'' -re '/def down/,$d' */* | |
# count unique migration files per repo that modify existing schema structure (tables, columns) | |
# depends on ag silver searcher but could be modified to use grep | |
ag -l -i '(remove|drop|rename|alter|change)[ _](?!(foreign_key|index|column_(null|default)))' |cut -d/ -f1 |sort |uniq -c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment