105 lines
2.1 KiB
Plaintext
105 lines
2.1 KiB
Plaintext
// 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 = ?
|
|
)
|
|
read one (
|
|
select user
|
|
where user.id = ?
|
|
)
|
|
create user ( )
|
|
update user ( where user.id = ? )
|
|
delete user ( where user.id = ? )
|
|
|
|
|
|
model project (
|
|
key id
|
|
|
|
field id blob
|
|
|
|
field 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 = ?
|
|
)
|
|
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 member_id project_id
|
|
|
|
field member_id user.id cascade
|
|
field project_id project.id cascade
|
|
|
|
field created_at timestamp ( autoinsert )
|
|
)
|
|
|
|
read all (
|
|
select project_member
|
|
where project_member.member_id = ?
|
|
)
|
|
read limitoffset (
|
|
select project_member
|
|
where project_member.project_id = ?
|
|
)
|
|
create project_member ( )
|
|
delete project_member (
|
|
where project_member.member_id = ?
|
|
where project_member.project_id = ?
|
|
)
|
|
|
|
model api_key (
|
|
key id
|
|
unique key
|
|
unique name project_id
|
|
|
|
field id blob
|
|
field project_id project.id cascade
|
|
|
|
field key blob
|
|
|
|
field name text (updatable)
|
|
|
|
field created_at timestamp ( autoinsert )
|
|
)
|
|
|
|
create api_key ()
|
|
update api_key ( where api_key.id = ? )
|
|
delete api_key ( where api_key.id = ? )
|
|
|
|
read one (
|
|
select api_key
|
|
where api_key.id = ?
|
|
)
|
|
read all (
|
|
select api_key
|
|
where api_key.project_id = ?
|
|
orderby asc api_key.name
|
|
) |