Separate! You lose the flexibility to move logic between the application and the database when the database is its own API.