text: ---
  -- Main Table that stores metric details
  ---
  
  
  CREATE TABLE IF NOT EXISTS tip_wlan_keyspace.service_metric (
      customerId int,
      equipmentId bigint,
      dayOfYear int,
      clientMac bigint,
      dataType int,
  
      createdTimestamp bigint,
  
      locationId bigint,
      details blob,
  
      PRIMARY KEY ((customerId, equipmentId, dayOfYear), clientMac, dataType, createdTimestamp)
  ) WITH comment='Wlan service metrics for Equipment and Network generated by the TIP WLAN CloudSDK. Records automatically expire after 30 days'
      AND default_time_to_live = 691200;
  
  ---
  -- Tables to support filtering by customer, equipment and macAddress
  ---
  
  CREATE TABLE IF NOT EXISTS tip_wlan_keyspace.service_metric_by_customer (
      customerId int,
      equipmentId bigint,
      dayOfYear int,
      clientMac bigint,
      dataType int,
  
      createdTimestamp bigint,
  
      PRIMARY KEY ((customerId), createdTimestamp, equipmentId, clientMac, dataType)
  ) WITH comment='Look up Wlan service metrics by customer. Records automatically expire after 30 days'
      AND default_time_to_live = 691200;
  
  CREATE TABLE IF NOT EXISTS tip_wlan_keyspace.service_metric_by_equipment (
      customerId int,
      equipmentId bigint,
      dayOfYear int,
      clientMac bigint,
      dataType int,
  
      createdTimestamp bigint,
  
      PRIMARY KEY ((customerId, equipmentId), createdTimestamp, clientMac, dataType)
  ) WITH comment='Look up Wlan service metrics by equipment. Records automatically expire after 30 days'
      AND default_time_to_live = 691200;
  
   CREATE TABLE IF NOT EXISTS tip_wlan_keyspace.service_metric_by_mac (
      customerId int,
      equipmentId bigint,
      dayOfYear int,
      clientMac bigint,
      dataType int,
  
      createdTimestamp bigint,
  
      PRIMARY KEY ((customerId, clientMac), createdTimestamp, equipmentId, dataType)
  ) WITH comment='Look up Wlan service metrics by client Mac address. Records automatically expire after 30 days'
      AND default_time_to_live = 691200;
  
   CREATE TABLE IF NOT EXISTS tip_wlan_keyspace.service_metric_by_mac_and_equipment (
      customerId int,
      equipmentId bigint,
      dayOfYear int,
      clientMac bigint,
      dataType int,
  
      createdTimestamp bigint,
  
      PRIMARY KEY ((customerId, clientMac), equipmentId, createdTimestamp, dataType)
  ) WITH comment='Look up Wlan service metrics by client Mac address and equipment. Records automatically expire after 30 days'
      AND default_time_to_live = 691200;
  
  ---
  -- Tables to support filtering by the datatype
  ---
  
  CREATE TABLE IF NOT EXISTS tip_wlan_keyspace.service_metric_by_customer_datatype (
      customerId int,
      equipmentId bigint,
      dayOfYear int,
      clientMac bigint,
      dataType int,
  
      createdTimestamp bigint,
  
      PRIMARY KEY ((customerId), dataType, createdTimestamp, equipmentId, clientMac)
  ) WITH comment='Look up Wlan service metrics by customer and data type. Records automatically expire after 30 days'
      AND default_time_to_live = 691200;
  
  CREATE TABLE IF NOT EXISTS tip_wlan_keyspace.service_metric_by_equipment_datatype (
      customerId int,
      equipmentId bigint,
      dayOfYear int,
      clientMac bigint,
      dataType int,
  
      createdTimestamp bigint,
  
      PRIMARY KEY ((customerId, equipmentId), dataType, createdTimestamp, clientMac)
  ) WITH comment='Look up Wlan service metrics by equipment and datatype. Records automatically expire after 30 days'
      AND default_time_to_live = 691200;
  
   CREATE TABLE IF NOT EXISTS tip_wlan_keyspace.service_metric_by_mac_datatype (
      customerId int,
      equipmentId bigint,
      dayOfYear int,
      clientMac bigint,
      dataType int,
  
      createdTimestamp bigint,
  
      PRIMARY KEY ((customerId, clientMac), dataType, createdTimestamp, equipmentId)
  ) WITH comment='Look up Wlan service metrics by client Mac address and datatype. Records automatically expire after 30 days'
      AND default_time_to_live = 691200;
  
   CREATE TABLE IF NOT EXISTS tip_wlan_keyspace.service_metric_by_mac_and_equipment_datatype (
      customerId int,
      equipmentId bigint,
      dayOfYear int,
      clientMac bigint,
      dataType int,
  
      createdTimestamp bigint,
  
      PRIMARY KEY ((customerId, clientMac), equipmentId, dataType, createdTimestamp)
  ) WITH comment='Look up Wlan service metrics by client Mac address and equipment and datatype. Records automatically expire after 30 days'
      AND default_time_to_live = 691200;
  
   CREATE TABLE IF NOT EXISTS tip_wlan_keyspace.service_metric_by_location (
      customerId int,
      equipmentId bigint,
      dayOfYear int,
      clientMac bigint,
      dataType int,
  
      createdTimestamp bigint,
      locationId bigint,
  
      PRIMARY KEY ((customerId, locationId), createdTimestamp, equipmentId, clientMac, dataType)
  ) WITH comment='Look up Wlan service metrics by location. Records automatically expire after 30 days'
      AND default_time_to_live = 691200;
  
   CREATE TABLE IF NOT EXISTS tip_wlan_keyspace.service_metric_by_location_all_filters (
      customerId int,
      equipmentId bigint,
      dayOfYear int,
      clientMac bigint,
      dataType int,
  
      createdTimestamp bigint,
      locationId bigint,
  
      PRIMARY KEY ((customerId, locationId), equipmentId, clientMac, dataType, createdTimestamp)
  ) WITH comment='Look up Wlan service metrics by location. Records automatically expire after 30 days'
      AND default_time_to_live = 691200;
  