(WIP) Initial support for sending metadata to postgres

DO NOT MERGE THIS