dragonbane

SQL table

Sep 30th, 2018
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.04 KB | None | 0 0
  1. Table ip_bans:
  2. ip: INET (primary)
  3. infractions: smallint
  4. expires_at: timestamp without time zone (30 days after a ban, refreshed with each new infraction, after 3 infractions perman ban on the account)
  5.  
  6. Table users: (DONE)
  7. uid: character varying[64] (primary)
  8. fcm_device_token: text[]
  9. last_app_language: character[2] (default: 'en')
  10. first_name: text
  11. family_name: text
  12. gender: char
  13. birthdate: date
  14. country_code: character[2]
  15. rating: real (default: -1)
  16. blocked_users: character varying[64] []
  17. newsletter: boolean (default: false)
  18. banned: boolean (default: false)
  19. creationtimestamp: timestamp without time zone
  20. restricted_until: timestamp without time zone (curr time + 20 secs after a critical action)
  21.  
  22. Table messages_quick_rides: (DONE)
  23. id: bigserial (primary)
  24. matched_ride_id: bigint (required, unique id identifying the matched ride - LINKED to matched_quick_rides table as foreign key, on DELETE DROP)
  25. sender: character varying[64] (not required, foreign key user table, on DELETE SET NULL)
  26. content: text
  27. creationtimestamp: timestamp without time zone
  28.  
  29. Table ratings:
  30. id: bigserial (primary)
  31. status: smallint (0= pending, 1= rating given, 2= dismissed) (default: 0)
  32. recipient: character varying[64] (required, foreign key user table, on DELETE DROP)
  33. sender: character varying[64] (not required, foreign key user table, on DELETE SET NULL)
  34. rating: real (0.0 - 5.0), can be NULL
  35. ride_id: bigint (not required, unique id identifying the ride - LINKED to past_rides table id as foreign key, on DELETE SET NULL)
  36. creationtimestamp: timestamp without time zone (as soon as a ride moves to past rides)
  37.  
  38. Table quick_rides: (DONE) (only one per user)
  39. id: bigserial (primary)
  40. status: smallint (0=active/searching, 1=idle/waiting, 2=match accepted, 3=ride finished, 4=aborted) (default: 0)
  41. matched_ride_id: bigint (not required, unique id identifying the matched ride - LINKED to matched_quick_rides table as foreign key, on DELETE SET NULL)
  42. previously_compared: bigint[]
  43. last_route_attempt: timestamp without time zone
  44. origin_name: text
  45. origin_osm_id: text
  46. origin_pos: postgis.geography (PostGIS)
  47. origin_post_code: text
  48. origin_city: text
  49. origin_county: text
  50. origin_state: text
  51. origin_country_code: character[2]
  52. destination_name: text
  53. destination_osm_id: text
  54. destination_pos: postgis.geography (PostGIS)
  55. destination_post_code: text
  56. destination_city: text
  57. destination_county: text
  58. destination_state: text
  59. destination_country_code: character[2]
  60. waypoints: postgis.geography[]
  61. geometry: text
  62. distance: integer (in Meter, fastest route for user)
  63. duration: integer (length of ride in seconds, fastest route for user)
  64. creator: character varying[64] (not required, foreign key user table, on DELETE SET NULL)
  65. search_radius: real (in km e.g. 0.5 km) (default: 2.0 km)
  66. creationtimestamp: timestamp without time zone
  67.  
  68. Table matched_quick_rides: (DONE)
  69. id: bigserial (primary)
  70. status: smallint (0=active/routed, 1=in-progress, 2= finished, 3=aborted) (default: 0)
  71. riders: character varying[64] [] (stored in alphabetical order of who A and B is)
  72. riders_finished: character varying[64] []
  73. origin_name: text
  74. origin_osm_id: text
  75. origin_pos: postgis.geography (PostGIS)
  76. origin_post_code: text
  77. origin_city: text
  78. origin_county: text
  79. origin_state: text
  80. origin_country_code: character[2]
  81. destination_name: text
  82. destination_osm_id: text
  83. destination_pos: postgis.geography (PostGIS)
  84. destination_post_code: text
  85. destination_city: text
  86. destination_county: text
  87. destination_state: text
  88. destination_country_code: character[2]
  89. route_order: text (e.g. 'ABAB')
  90. polylines_data: postgis.geography[] (array of polylines according to route order, first is A-B, then B-C, then C-D)
  91. polylines_lengths: integer[] (length in Meter for each polyline in the same order as above)
  92. geometry: text
  93. distance: integer (total distance in Meter for joined ride)
  94. duration: integer (total length of ride in seconds, joined ride)
  95. creationtimestamp: timestamp without time zone
  96.  
  97.  
  98. Table messages_planned_rides:
  99. id: bigserial (primary)
  100. planned_ride_id: bigint (required, unique id identifying the target planned ride - LINKED to planned_rides table as foreign key, on DELETE DROP)
  101. sender: character varying[64] (not required, foreign key user table, on DELETE SET NULL)
  102. content: text
  103. creationtimestamp: timestamp without time zone
  104.  
  105. Table planned_rides: (max 3 per user)
  106. id: bigserial (primary)
  107. status: smallint (0=active, 1=in-progress, 2= finished, 3=aborted) (default: 0)
  108. riders: character varying[64] []
  109. riders_finished: character varying[64] []
  110. date_time: timestamp without timezone
  111. origin_name: text
  112. origin_osm_id: text
  113. origin_pos: postgis.geography (PostGIS)
  114. origin_post_code: text
  115. origin_city: text
  116. origin_county: text
  117. origin_state: text
  118. origin_country_code: character[2]
  119. destination_name: text
  120. destination_osm_id: text
  121. destination_pos: postgis.geography (PostGIS)
  122. destination_post_code: text
  123. destination_city: text
  124. destination_county: text
  125. destination_state: text
  126. destination_country_code: character[2]
  127. waypoints: postgis.geography[]
  128. geometry: text
  129. distance: integer (in Meter, fastest route for creator)
  130. duration: integer (length of ride in seconds, fastest route for creator)
  131. creator: character varying[64] (not required, foreign key user table, on DELETE SET NULL)
  132. creationtimestamp: timestamp without time zone
  133.  
  134.  
  135. Table past_rides:
  136. id: bigserial (primary)
  137. riders: character varying[64] []
  138. date_time: timestamp without timezone
  139. origin_name: text
  140. origin_osm_id: text
  141. origin_pos: postgis.geography (PostGIS)
  142. origin_post_code: text
  143. origin_city: text
  144. origin_county: text
  145. origin_state: text
  146. origin_country_code: character[2]
  147. destination_name: text
  148. destination_osm_id: text
  149. destination_pos: postgis.geography (PostGIS)
  150. destination_post_code: text
  151. destination_city: text
  152. destination_county: text
  153. destination_state: text
  154. destination_country_code: character[2]
  155. geometry: text
  156. distance: integer (in Meter)
  157. duration: integer (length of ride in seconds)
  158. creator: character varying[64] (not required, foreign key user table, on DELETE DROP)
  159. creationtimestamp: timestamp without time zone
Add Comment
Please, Sign In to add comment