Skip to content

Database Documentation

Pepijn Compaan edited this page Feb 11, 2015 · 30 revisions

#Overview Postduif runs on a sqlite database. This is an overview of the data stored in this database.

  • user
  • id:int
  • username:varchar(50)
  • password:varchar(250)
  • salt:varchar(250)
  • email:varchar(50)
  • location:varchar(100) {lat,lng}
  • duif
  • id:int
  • name:varchar(50) user defined
  • speed:int m/s, possible dependent of level
  • level:int optional, see training
  • user_id:int (FK)
  • transport_user_id:int null if duif is at home, user_id if duif is transmported to another user.
  • flight
  • id:int
  • duif_id:int FK
  • start_time:int epoch timestamp
  • end_time:int epoch timestamp
  • msg_id:int FK
  • message
  • id:int
  • msg:text
  • receiver_id:int FK
  • sender_id:int FK
  • sealed:boolean maybe just int
  • status:int send(0), received(1) or read(2)

##Duif state The duif's are in one of three states. These are:

Flight
The duif is in flight. The flight is saved in the flight table.

At home
The duif is at the home location stored in the duif table.

At destination
The duif is at the destination of its last flight. The last record in the flight table with a link to the corresponding duif contains the location in the end {lat,lng} field.

##{lat,lng} {lat,lng} is a javascript object containing the latitude and longtitude. This object is stored as a string so must be parsed. This is done by using JSON.parse(str) in javascript.

##TODO Thing to consider for the future:

  • Duif transportation (carts)
  • Duif housing
  • Training
  • Incidents (Raptors, storms, etc.)
  • Send path. More receivers to get to the destination.

Clone this wiki locally