Migrate from sqlite to postgresql. Fix specs related to this change