models.py 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. from app import db
  2. class User(db.Model):
  3. __tablename__ = 'user'
  4. userID = db.Column(db.Integer, primary_key=True)
  5. firstname = db.Column(db.String(30), nullable=False)
  6. lastname = db.Column(db.String(30), nullable=False)
  7. mail = db.Column(db.String(50), nullable=False)
  8. phone = db.Column(db.String(20), nullable=False)
  9. username = db.Column(db.String(30), nullable=False, unique=True)
  10. password = db.Column(db.String(40), nullable=False)
  11. status = db.Column(db.Integer, nullable=False, info='0:admin;1:new;9:disable')
  12. class LiquidTank(db.Model):
  13. __tablename__ = 'liquid_tank'
  14. sn = db.Column(db.Integer, primary_key=True)
  15. datetime = db.Column(db.DateTime, nullable=False)
  16. fitolab = db.Column(db.Integer, nullable=False, default=1)
  17. tk1_duration1 = db.Column(db.Text, nullable=True)
  18. tk1_start1 = db.Column(db.Text, nullable=True)
  19. tk1_end1 = db.Column(db.Text, nullable=True)
  20. tk1_duration2 = db.Column(db.Text, nullable=True)
  21. tk1_start2 = db.Column(db.Text, nullable=True)
  22. tk1_end2 = db.Column(db.Text, nullable=True)
  23. tk1_duration3 = db.Column(db.Text, nullable=True)
  24. tk1_start3 = db.Column(db.Text, nullable=True)
  25. tk1_end3 = db.Column(db.Text, nullable=True)
  26. tk2_duration1 = db.Column(db.Text, nullable=True)
  27. tk2_start1 = db.Column(db.Text, nullable=True)
  28. tk2_end1 = db.Column(db.Text, nullable=True)
  29. tk2_duration2 = db.Column(db.Text, nullable=True)
  30. tk2_start2 = db.Column(db.Text, nullable=True)
  31. tk2_end2 = db.Column(db.Text, nullable=True)
  32. tk2_duration3 = db.Column(db.Text, nullable=True)
  33. tk2_start3 = db.Column(db.Text, nullable=True)
  34. tk2_end3 = db.Column(db.Text, nullable=True)
  35. class LightControl(db.Model):
  36. __tablename__ = 'light_control'
  37. sn = db.Column(db.Integer, primary_key=True)
  38. datetime = db.Column(db.DateTime, nullable=True)
  39. fitolab = db.Column(db.Integer, nullable=False, default=1)
  40. l_kind = db.Column(db.Text, nullable=False)
  41. l_start = db.Column(db.Text, nullable=True)
  42. l_end = db.Column(db.Text, nullable=True)
  43. l_r = db.Column(db.Integer, nullable=True)
  44. l_g = db.Column(db.Integer, nullable=True)
  45. l_b = db.Column(db.Integer, nullable=True)
  46. l_bright_auto = db.Column(db.Integer, nullable=False, info='0:off;1:on')
  47. l_bright_vol = db.Column(db.Integer, nullable=False)
  48. class MusicControl(db.Model):
  49. __tablename__ = 'music_control'
  50. sn = db.Column(db.Integer, primary_key=True)
  51. datetime = db.Column(db.DateTime, nullable=True)
  52. fitolab = db.Column(db.Integer, nullable=False, default=1)
  53. m_vol = db.Column(db.Text, nullable=False, default='40')
  54. m_playlist = db.Column(db.Integer, nullable=True)
  55. m_start = db.Column(db.Text, nullable=True)
  56. m_end = db.Column(db.Text, nullable=True)
  57. class VibrationControl(db.Model):
  58. __tablename__ = 'vibration_control'
  59. sn = db.Column(db.Integer, primary_key=True)
  60. datetime = db.Column(db.DateTime, nullable=False)
  61. fitolab = db.Column(db.Integer, nullable=False, default=1)
  62. v_power = db.Column(db.Text, nullable=False, default='40')
  63. v_vol = db.Column(db.Text, nullable=False)
  64. v_start = db.Column(db.Text, nullable=False)
  65. v_end = db.Column(db.Text, nullable=False)
  66. class CameraControl(db.Model):
  67. __tablename__ = 'camera_control'
  68. sn = db.Column(db.Integer, primary_key=True)
  69. datetime = db.Column(db.DateTime, nullable=False)
  70. fitolab = db.Column(db.Integer, nullable=False, default=1)
  71. c_status = db.Column(db.Integer, nullable=False, info='0:off;1:on')
  72. c_piriodicity = db.Column(db.Text, nullable=False)
  73. c_live_stream = db.Column(db.Text, nullable=False)
  74. class Gallery(db.Model):
  75. __tablename__ = 'gallery'
  76. sn = db.Column(db.Integer, primary_key=True)
  77. datetime = db.Column(db.DateTime, nullable=False)
  78. fitolab = db.Column(db.Integer, nullable=False, default=1)
  79. img = db.Column(db.Text, nullable=False)
  80. class RootSystem(db.Model):
  81. __tablename__ = 'root_system'
  82. sn = db.Column(db.Integer, primary_key=True)
  83. datetime = db.Column(db.DateTime, nullable=False)
  84. fitolab = db.Column(db.Integer, nullable=False, default=1)
  85. tem_tem1 = db.Column(db.Text, nullable=True)
  86. tem_start1 = db.Column(db.Text, nullable=True)
  87. tem_end1 = db.Column(db.Text, nullable=True)
  88. tem_tem2 = db.Column(db.Text, nullable=True)
  89. tem_start2 = db.Column(db.Text, nullable=True)
  90. tem_end2 = db.Column(db.Text, nullable=True)
  91. tem_tem3 = db.Column(db.Text, nullable=True)
  92. tem_start3 = db.Column(db.Text, nullable=True)
  93. tem_end3 = db.Column(db.Text, nullable=True)
  94. l_start1 = db.Column(db.Text, nullable=True)
  95. l_end1 = db.Column(db.Text, nullable=True)
  96. l_start2 = db.Column(db.Text, nullable=True)
  97. l_end2 = db.Column(db.Text, nullable=True)
  98. l_start3 = db.Column(db.Text, nullable=True)
  99. l_end3 = db.Column(db.Text, nullable=True)
  100. l_r = db.Column(db.Integer, nullable=True)
  101. l_g = db.Column(db.Integer, nullable=True)
  102. l_b = db.Column(db.Integer, nullable=True)
  103. l_bright_auto = db.Column(db.Integer, nullable=True, info='0:off;1:on')
  104. l_bright_vol = db.Column(db.Integer, nullable=True)
  105. fan_status = db.Column(db.Integer, nullable=True, info='0:off;1:on')
  106. fan_periodicity = db.Column(db.Text, nullable=True)
  107. fan_duration = db.Column(db.Text, nullable=True)
  108. fan_speed = db.Column(db.Text, nullable=True)
  109. humidity = db.Column(db.Text, nullable=True)
  110. class StemSystem(db.Model):
  111. __tablename__ = 'stem_system'
  112. sn = db.Column(db.Integer, primary_key=True)
  113. datetime = db.Column(db.DateTime, nullable=False)
  114. fitolab = db.Column(db.Integer, nullable=False, default=1)
  115. tem_tem1 = db.Column(db.Text, nullable=True)
  116. tem_start1 = db.Column(db.Text, nullable=True)
  117. tem_end1 = db.Column(db.Text, nullable=True)
  118. tem_tem2 = db.Column(db.Text, nullable=True)
  119. tem_start2 = db.Column(db.Text, nullable=True)
  120. tem_end2 = db.Column(db.Text, nullable=True)
  121. tem_tem3 = db.Column(db.Text, nullable=True)
  122. tem_start3 = db.Column(db.Text, nullable=True)
  123. tem_end3 = db.Column(db.Text, nullable=True)
  124. l_start1 = db.Column(db.Text, nullable=True)
  125. l_end1 = db.Column(db.Text, nullable=True)
  126. l_start2 = db.Column(db.Text, nullable=True)
  127. l_end2 = db.Column(db.Text, nullable=True)
  128. l_start3 = db.Column(db.Text, nullable=True)
  129. l_end3= db.Column(db.Text, nullable=True)
  130. l_r = db.Column(db.Integer, nullable=True)
  131. l_g = db.Column(db.Integer, nullable=True)
  132. l_b = db.Column(db.Integer, nullable=True)
  133. l_bright_auto = db.Column(db.Integer, nullable=True, info='0:off;1:on')
  134. l_bright_vol = db.Column(db.Integer, nullable=True)
  135. c_status = db.Column(db.Integer, nullable=True, info='0:off;1:on')
  136. c_duration = db.Column(db.Text, nullable=True)
  137. t_n_s_tem1 = db.Column(db.Text, nullable=True)
  138. t_n_s_start1 = db.Column(db.Text, nullable=True)
  139. t_n_s_end1 = db.Column(db.Text, nullable=True)
  140. t_n_s_tem2 = db.Column(db.Text, nullable=True)
  141. t_n_s_start2 = db.Column(db.Text, nullable=True)
  142. t_n_s_end2 = db.Column(db.Text, nullable=True)
  143. t_n_s_tem3 = db.Column(db.Text, nullable=True)
  144. t_n_s_start3 = db.Column(db.Text, nullable=True)
  145. t_n_s_end3 = db.Column(db.Text, nullable=True)
  146. m_vol = db.Column(db.Text, nullable=True, default='40')
  147. m_playlist1 = db.Column(db.Text, nullable=True)
  148. m_start1 = db.Column(db.Text, nullable=True)
  149. m_end1 = db.Column(db.Text, nullable=True)
  150. m_playlist2 = db.Column(db.Text, nullable=True)
  151. m_start2 = db.Column(db.Text, nullable=True)
  152. m_end2 = db.Column(db.Text, nullable=True)
  153. m_playlist3 = db.Column(db.Text, nullable=True)
  154. m_start3 = db.Column(db.Text, nullable=True)
  155. m_end3 = db.Column(db.Text, nullable=True)
  156. u_s_status = db.Column(db.Integer, nullable=True, info='0:off;1:on')
  157. u_s_vol = db.Column(db.Text, nullable=True)
  158. u_s_start1 = db.Column(db.Text, nullable=True)
  159. u_s_end1 = db.Column(db.Text, nullable=True)
  160. u_s_start2 = db.Column(db.Text, nullable=True)
  161. u_s_end2 = db.Column(db.Text, nullable=True)
  162. u_s_start3 = db.Column(db.Text, nullable=True)
  163. u_s_end3 = db.Column(db.Text, nullable=True)
  164. v_power = db.Column(db.Text, nullable=True, default='40')
  165. v_vol1 = db.Column(db.Text, nullable=True)
  166. v_start1 = db.Column(db.Text, nullable=True)
  167. v_end1 = db.Column(db.Text, nullable=True)
  168. v_vol2 = db.Column(db.Text, nullable=True)
  169. v_start2 = db.Column(db.Text, nullable=True)
  170. v_end2 = db.Column(db.Text, nullable=True)
  171. v_vol3 = db.Column(db.Text, nullable=True)
  172. v_start3 = db.Column(db.Text, nullable=True)
  173. v_end3 = db.Column(db.Text, nullable=True)
  174. w_vol1 = db.Column(db.Text, nullable=True)
  175. w_start1 = db.Column(db.Text, nullable=True)
  176. w_end1 = db.Column(db.Text, nullable=True)
  177. w_vol2 = db.Column(db.Text, nullable=True)
  178. w_start2 = db.Column(db.Text, nullable=True)
  179. w_end2 = db.Column(db.Text, nullable=True)
  180. w_vol3 = db.Column(db.Text, nullable=True)
  181. w_start3 = db.Column(db.Text, nullable=True)
  182. w_end3 = db.Column(db.Text, nullable=True)
  183. rh = db.Column(db.Text, nullable=True)
  184. class Fitolab1Sensor(db.Model):
  185. __tablename__ = 'fitolab1_sensor'
  186. sn = db.Column(db.Integer, primary_key=True)
  187. datetime = db.Column(db.DateTime, nullable=False)
  188. s_humidity = db.Column(db.Float, nullable=True)
  189. s_wind_flow = db.Column(db.Float, nullable=True)
  190. s_temp = db.Column(db.Float, nullable=True)
  191. s_near_stem1 = db.Column(db.Float, nullable=True)
  192. s_near_stem2 = db.Column(db.Float, nullable=True)
  193. s_air_tem1 = db.Column(db.Float, nullable=True)
  194. s_air_tem2 = db.Column(db.Float, nullable=True)
  195. s_orp = db.Column(db.Float, nullable=True)
  196. s_wgt = db.Column(db.Float, nullable=True)
  197. s_wgt_sensor1 = db.Column(db.Float, nullable=True)
  198. s_wgt_sensor2 = db.Column(db.Float, nullable=True)
  199. s_water_frequency = db.Column(db.Float, nullable=True)
  200. s_h2 = db.Column(db.Float, nullable=True)
  201. s_n2 = db.Column(db.Float, nullable=True)
  202. s_c2h4 = db.Column(db.Float, nullable=True)
  203. s_o3 = db.Column(db.Float, nullable=True)
  204. s_o2 = db.Column(db.Float, nullable=True)
  205. s_co2 = db.Column(db.Float, nullable=True)
  206. s_chlorophyll = db.Column(db.Float, nullable=True)
  207. s_leaf = db.Column(db.Text, nullable=True)
  208. r_humidity = db.Column(db.Float, nullable=True)
  209. r_air_temp = db.Column(db.Float, nullable=True)
  210. r_water_temp = db.Column(db.Float, nullable=True)
  211. r_orp = db.Column(db.Float, nullable=True)
  212. r_ec = db.Column(db.Float, nullable=True)
  213. r_do = db.Column(db.Float, nullable=True)
  214. r_ed = db.Column(db.Float, nullable=True)
  215. r_wind_flow = db.Column(db.Float, nullable=True)
  216. r_water_level = db.Column(db.Text, nullable=True)
  217. r_fluorine = db.Column(db.Float, nullable=True)
  218. r_ph = db.Column(db.Float, nullable=True)
  219. r_turbidity = db.Column(db.Float, nullable=True)
  220. r_nh4 = db.Column(db.Float, nullable=True)
  221. r_co2 = db.Column(db.Float, nullable=True)
  222. r_no3 = db.Column(db.Float, nullable=True)
  223. r_no2 = db.Column(db.Float, nullable=True)
  224. # db.create_all()