SQL endpoints
$sql
GET
<base-url>/$sql
Execute SQL in Aidbox
Request Body
Example request:
SQL migrations
Aidbox provides POST and GET /db/migrations
operations to enable SQL migrations, which can be used to migrate/transform data, create helper functions, views etc.
POST /db/migrations
accepts array of {id,sql}
objects. If the migration with such id wasn't executed, execute it. Execution will be stopped on the first exception. This operation returns only freshly executed migrations. It means that if there are no pending migrations, you will get an empty array in the response body.
For your application you can keep migrations.yaml
file under source control. Add new migrations to the end of this file when this is required. With each deployment you can ensure migrations are applied on your server using a simple script like this:
By GET /db/migrations
you can introspect which migrations were already applied on the server:
Last updated