[ticket/11370] Effectively installed migrations not inserted into table

insert_migration() function now handles inserting/updating

Move all insert/update code to insert_migration() function to prevent this from occurring again.

http://tracker.phpbb.com/browse/PHPBB3-11370