Add code to keep database up-to-date when automigrate is enabled