Migrated to Postgres

MIGRATED BYACH!
Some changes in querying