make migration script proof against multiple executions
implement basic JS polling