Farm

Tables (9)

device

  • id — int — Primary key — NOT NULL — The unique id of a device
  • serial_number — varchar(191) — The serial number of a device
  • manufacturer — varchar(191) — The manufacturer of a device
  • name — varchar(191) — The name of a device given by a user
  • type — enum('SENSOR', 'ACTUATOR') — The type of a device
  • created_at — datetime — The date time of a device registered

device_group

  • id — int — Primary key — NOT NULL — The unique id of a device group
  • name — varchar(45) — NOT NULL — The name of a device group

device_group_device_map

  • device_id — int — Foreign key → device.id — NOT NULL — The id of a device in a group
  • device_group_id — int — Foreign key → device_group.id — NOT NULL — The id of a device group

device_resource

  • id — int — Primary key — NOT NULL — The id of a resource
  • device_id — int — NOT NULL — The id of a device
  • sensor_id — int — NOT NULL
  • resource_type — enum('DryBulbTemperature', 'WetBulbTemperature', 'SoilTemperature', 'AbsoluteHumidity', 'RelativeHumidity', 'SoilHumidity', 'SolarIrradiance', 'SolarIrradiation', 'WindDirection', 'WindSpeed', 'ElectricalConductivity', 'PH', 'CO2', 'RainFall', 'CumulativeRainFall', 'Door', 'WaterLevel', 'FlowRate', 'IrrigationWaterUse', 'DewPointTemperature', 'WindowState', 'WindowOpenness', 'Fire', 'HumidityDeficit', 'Pressure', 'WinklerIndex', 'CanopyTemperature', 'CultureMediumWeight', 'CultureMediumWaterWeight', 'SugarContent', 'DrainWeight', 'DrainInput', 'DrainOutput', 'DrainPercent', 'DrainTotal', 'DissolvedOxygen', 'OxygenSaturation', 'Power', 'BlackOut', 'RemainedBattery', 'ReceivedSignalStrengthIndication', 'Cctv') — NOT NULL — The type of a resource
  • resource_data_type — enum('INT', 'FLOAT', 'STRING') — NOT NULL — The data type of a resource
  • resource_state — varchar(45) — The state of a resource
  • name — varchar(45)

farm

  • id — int — Primary key — NOT NULL
  • name — varchar(50)
  • map_lon — float
  • map_lat — float
  • license — varchar(45)
  • created_at — datetime
  • updated_at — datetime
  • is_deleted — tinyint

farm_device_group_map

  • device_group_id — int — Foreign key → device_group.id — NOT NULL — The id of a device group in a given farm
  • farm_id — int — Foreign key → user_farm_map.farm_id — NOT NULL — The id of a farm

login_history

  • id — int — Primary key — NOT NULL
  • user_id — int — Foreign key → user.id — NOT NULL
  • access_token — longtext — NOT NULL
  • refresh_token — longtext — NOT NULL
  • access_token_active — tinyint — NOT NULL
  • refresh_token_active — tinyint — NOT NULL
  • created_at — datetime — NOT NULL

user

  • id — int — Primary key — NOT NULL
  • uid — varchar(191) — NOT NULL
  • password — varchar(191) — NOT NULL
  • name — varchar(191)
  • email — varchar(191) — NOT NULL
  • phone_num — varchar(191) — NOT NULL
  • address1 — varchar(191)
  • address2 — varchar(191)
  • zip_code — varchar(191)
  • consent_require — tinyint
  • consent_selective — tinyint
  • created_at — datetime — NOT NULL
  • updated_at — datetime
  • is_deleted — tinyint — NOT NULL

user_farm_map

  • user_id — int — Primary key — NOT NULL — The id of a user who owns a given farm
  • farm_id — int — Foreign key → farm.id — NOT NULL — The id of a farm
  • type — enum('own', 'workAt') — The type of relation