added docstring
added docstring and used different variable names
fixed migrations that failed test, renamed variables, added docstring
added unittests for migrations
using single query to get the required data
added newline to end of file