storj/pkg/accounting/dbx/accounting.dbx
Jennifer Li Johnson ad4df839a8
Data at rest accounting database (#601)
* starts at rest storage db

* generates aggregate and granular models with dbx

* reverts gomod

* reverts gosum
2018-11-09 15:02:28 -05:00

38 lines
921 B
Plaintext

// dbx.v1 golang accounting.dbx .
model aggregate (
key node_id
field node_id text
field start_time timestamp ( updatable )
field interval int64 ( updatable )
field created_at timestamp ( autoinsert )
field updated_at timestamp ( autoinsert, autoupdate )
)
create aggregate ( )
update aggregate ( where aggregate.node_id = ? )
delete aggregate ( where aggregate.node_id = ? )
read one (
select aggregate
where aggregate.node_id = ?
)
model granular (
key node_id
field node_id text
field start_time timestamp ( updatable )
field end_time timestamp ( updatable )
field data_total int64 ( updatable )
field created_at timestamp ( autoinsert )
field updated_at timestamp ( autoinsert, autoupdate )
)
create granular ( )
update granular ( where granular.node_id = ? )
delete granular ( where granular.node_id = ? )
read one (
select granular
where granular.node_id = ?
)