logo
Updated

Ronin

CRUD

create (creating models, like CREATE TABLE)
alter (altering models, like ALTER TABLE)
drop (dropping models, like DROP TABLE)

These query types are used for interacting with data:

add (adding records)
set (updating records)
get (retrieving records)
remove (removing records)
count (counting records)

Commands

Apply code schema: bunx ronin diff --apply

Local .sqlite from ronin-schema

bunx ronin diff --local > write the relative path to the ronin-schema.ts > bunx ronin apply --local

can delete the created migration aftero

Rules

all actions should be one client query call (1 network request)

Code

await remove.users() // remove all `users`

Notes

using to resolve ronin fields fully

curl -X POST --header 'Authorization: Bearer iasdga' -H 'Content-Type: application/json' -d '{"nativeQueries": ["SELECT * FROM users"]}' https://data.ronin.co

you can use a queries property instead of nativeQueries, which can hold an array of RONIN query objects

"queries": [{
  "get": {"users": null}
}]
curl -X GET -H 'Authorization: Bearer 1234' 'https://ronin.supply/@ronin/solbond'
// .get sorted by date  
await get.accounts.with.upgradedAt.greaterThan(new Date());

To automatically have related records cleaned up when a target of a link gets deleted, set the actions attribute of the respective link field

comments not supported in sql()