storj/pkg/satellite/satellitedb/dbx/satellitedb.dbx

111 lines
2.5 KiB
Plaintext
Raw Normal View History

// dbx.v1 golang satellitedb.dbx .
model user (
key id
unique email
field id blob
field first_name text ( updatable )
field last_name text ( updatable )
field email text ( updatable )
field password_hash blob ( updatable )
field created_at timestamp ( autoinsert )
)
read one (
select user
where user.email = ?
where user.password_hash = ?
)
read one (
select user
where user.id = ?
)
create user ( )
update user ( where user.id = ? )
delete user ( where user.id = ? )
model company (
key user_id
field user_id user.id cascade
field name text ( updatable )
field address text ( updatable )
field country text ( updatable )
field city text ( updatable )
field state text ( updatable )
field postal_code text ( updatable )
field created_at timestamp ( autoinsert )
)
read one (
select company
where company.user_id = ?
)
create company ( )
update company ( where company.user_id = ? )
delete company ( where company.user_id = ? )
model project (
key id
field id blob
field owner_id user.id setnull ( nullable, updatable )
field name text
field company_name text
field description text ( updatable )
// stores last accepted version of terms of use
field terms_accepted int ( updatable )
field created_at timestamp ( autoinsert )
)
read all ( select project)
read one (
select project
where project.id = ?
)
2018-11-14 12:45:49 +00:00
read all (
select project
2018-11-14 12:45:49 +00:00
where project.owner_id = ?
)
read all (
select project
join project.id = project_member.project_id
where project_member.member_id = ?
)
create project ( )
update project ( where project.id = ? )
delete project ( where project.id = ? )
model project_member (
key id
field id blob
field member_id user.id cascade
field project_id project.id cascade ( updatable )
field created_at timestamp ( autoinsert )
)
read all ( select project_member)
read all (
select project_member
where project_member.project_id = ?
)
read one (
select project_member
where project_member.member_id = ?
)
read one (
select project_member
where project_member.id = ?
)
create project_member ( )
update project_member ( where project_member.id = ? )
delete project_member ( where project_member.id = ? )