Creating a plugin to add a service and route

Hi all,

I’m trying to create a plugin which can add a service and route on the fly, I’ve managed to work out how to add a service by inserting a table into kong.db.services, and I’m assuming a similar process can be done for routes, however I can’t for the life of me work out how to link a service to a route via the plugin, has anyone done this before? The documentation mentions that kong.db schema will be posted in due course.