Migrate data. Refactor script.

Data is now migrated to the postgres database via the COPY function. Data from the MSSQL database is paginated as TinyTDS is not robust with large tables. Parts of script refactored out into functions.