This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | with "device_list" as (select distinct on ("devices"."id") "devices"."id", "devices"."serial", "devices"."out_of_service_at", "devices"."uuid", "devices"."name", "devices"."type_id", "sites"."id" as "site_id", "sites"."name" as "site_name", "zones"."id" as "zone_id", "zones"."name" as "zone_name", "assets"."name" as "asset_name", "assets"."id" as "asset_id", "device_types"."name" as "type_name" | |
| from "devices" left join "device_assets" on "device_assets"."device_id" = "devices"."id" | |
| left join "assets" on "assets"."id" = "device_assets"."asset_id" | |
| left join "zones" on "zones"."id" = "assets"."zone_id" | |
| left join "sites" on "sites"."id" = "zones"."site_id" | |
| left join "companies" on "companies"."id" = "devices"."company_id" | |
| left join "device_types" on "device_types"."id" = "devices"."type_id" | |
| where "devices"."is_deleted" = false | |
| and "devices"."company_id" = '28' | |
| and "zones"."id" in ('423', '424', '427')) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | select calibrationdescription.description, calibrationdata.channel_no, calibrationdata.value , sensortype.sensor_type_description from calibrationdata | |
| join calibrationdescription on calibrationdescription.id_calibration_description = calibrationdata.id_calibration_description | |
| join sensor on sensor.sensor_serial_no = calibrationdata.sensor_sensor_serial_no | |
| join sensortype on sensortype.id_sensor_type = sensor.id_sensor_type | |
| where calibrationdescription.description in ('HighCalibration', 'HighRaw','MidCalibration','MidRaw', 'LowCalibration', 'LOWRAW') | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | private static Bitmap Base64ToBitmap(string base64String) | |
| { | |
| byte[] imageBytes = Convert.FromBase64String(base64String); | |
| MemoryStream ms = new MemoryStream(imageBytes, 0, | |
| imageBytes.Length); | |
| ms.Write(imageBytes, 0, imageBytes.Length); | |
| return (Bitmap) Bitmap.FromStream(ms); | |
| } | |
| internal static Bitmap Battery => AlarmImages.Base64ToBitmap("AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRtYXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAALgEAAAJCTS4BAAAAAAAAPgAAACgAAAAyAAAAHgAAAAEAAQAAAAAAAAAAAMMOAADDDgAAAgAAAAIAAAD/////AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAApAAAH///gABoAAAgAABAAAAAAC4AAEAAAAAALgAAcAAAAAAuAAAQAAAAAC4AABAAAAAALgAAEAAAAAAuAABwAAAAAC4AAEAAAAAALgAAQAAAAAAgAABAAAAAAB///4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Waiting for deployments to stabilize... | |
| - deployment/dev-sc-api: creating container sc-api | |
| - pod/dev-sc-api-5bc94d4944-29fdx: creating container sc-api | |
| - deployment/dev-sc-api-gateway: waiting for rollout to finish: 1 old replicas are pending termination... | |
| - deployment/dev-sc-emailer: waiting for rollout to finish: 1 old replicas are pending termination... | |
| - deployment/dev-sc-file-processor: waiting for rollout to finish: 1 old replicas are pending termination... | |
| - deployment/dev-sc-front: creating container sc-front | |
| - pod/dev-sc-front-656f8958d6-wtxzc: creating container sc-front | |
| - deployment/dev-sc-img-resizer: waiting for rollout to finish: 1 old replicas are pending termination... | |
| - deployment/dev-sc-kafka: creating container kafka | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | skaffold dev | |
| Listing files to watch... | |
| - sc-seed | |
| - sc-w-clear-notes-presentation | |
| - sc-w-merge-slides | |
| - sc-w-data-fix | |
| - sc-w-upload-slide | |
| - sc-w-replace-slide | |
| - sc-w-presentation-info | |
| - sc-w-split-presentation | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | ALTER TABLE IF EXISTS public.sensor | |
| ADD CONSTRAINT sensor_hardware_serial_unique_index UNIQUE (hardware_serial_no); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | ALTER TABLE IF EXISTS public.controldevice DROP COLUMN IF EXISTS control_device_changed; | |
| ALTER TABLE IF EXISTS public.controldevice | |
| ALTER COLUMN control_device_disconnected SET DEFAULT false; | |
| ALTER TABLE IF EXISTS public.control_device_groups DROP COLUMN IF EXISTS control_device_group_changed; | |
| ALTER TABLE IF EXISTS public.control_device_groups | |
| ALTER COLUMN interval_value SET DEFAULT 0; | |
| ALTER TABLE IF EXISTS public.control_device_groups | |
| ADD COLUMN deleted boolean NOT NULL DEFAULT false; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Select setval('"controlDeviceGroups_idGroup_seq"', (SELECT max(id_group) as a FROM control_device_groups)+1); | |
| Select setval('"controldevice_idControlDevice_seq"', (SELECT max(id_control_device) as a FROM controldevice)+1); | |
| Select setval('"sensor_sensorSerialNo_seq"', (SELECT max(sensor_serial_no) as a FROM sensor)+1); | |
| Select setval('"company_idCompany_seq"', (SELECT max(id_company) as a FROM company)+1); | |
| Select setval('"sensormodel_idSensorModel_seq"', (SELECT max(id_sensor_model) as a FROM sensormodel)+1); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | DO $$ | |
| DECLARE | |
| i TEXT; | |
| BEGIN | |
| FOR i IN (select table_name from information_schema.tables where table_catalog='YOUR_DATABASE_NAME' and table_schema='public') LOOP | |
| EXECUTE 'Select setval('''||i||'_sq'', (SELECT max(id) as a FROM ' || i ||')+1);'; | |
| END LOOP; | |
| END$$; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /* | |
| First see the data | |
| */ | |
| SELECT to_timestamp("time" / 1000) | |
| FROM public.asset_properties_status | |
| where time > extract(epoch from now()) * 1000 | |
| order by time desc; | |