75213fa633
* V3-663 Extend database with Project entity * fixing linter
82 lines
1.7 KiB
Plaintext
82 lines
1.7 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 = ?
|
|
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 id
|
|
|
|
field id blob
|
|
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 = ?
|
|
)
|
|
read one (
|
|
select company
|
|
where company.id = ?
|
|
)
|
|
create company ( )
|
|
update company ( where company.id = ? )
|
|
delete company ( where company.id = ? )
|
|
|
|
model project (
|
|
key id
|
|
|
|
field id blob
|
|
field user_id user.id cascade
|
|
|
|
field name text ( updatable )
|
|
field description text ( updatable )
|
|
field is_agreed_with_terms bool ( updatable )
|
|
|
|
field created_at timestamp ( autoinsert )
|
|
)
|
|
|
|
read all ( select project)
|
|
read one (
|
|
select project
|
|
where project.id = ?
|
|
)
|
|
read one (
|
|
select project
|
|
where project.user_id = ?
|
|
)
|
|
create project ( )
|
|
update project ( where project.id = ? )
|
|
delete project ( where project.id = ? ) |