CREATE TABLE IF NOT EXISTS "ap_db_crate"."gpsdata_old" (
"deviceid" TEXT,
"assetid" TEXT,
"tsdbtime" TIMESTAMP WITHOUT TIME ZONE NOT NULL,
"doctype" TEXT,
"docversion" TEXT,
"info" OBJECT(DYNAMIC) AS (
"alarmstate" OBJECT(DYNAMIC) AS (
"boxstatus" TEXT,
"ignstatus" TEXT,
"msgpressed" TEXT,
"txnreason" TEXT
),
"assetInfo" OBJECT(DYNAMIC) AS (
"assetStatus" TEXT,
"assetid" TEXT,
"assetname" TEXT,
"hierarchyPath" TEXT,
"plantId" TEXT,
"plantName" TEXT,
"transporterCode" TEXT,
"transporterId" TEXT,
"transporterName" TEXT
),
"cellsite" OBJECT(DYNAMIC) AS (
"currentcellid" TEXT,
"lac" TEXT,
"mcc" TEXT,
"mnc" TEXT
),
"command" OBJECT(DYNAMIC) AS (
"auxipcode" TEXT,
"auxvalue" TEXT,
"cmdkey" TEXT,
"cmdvalue" TEXT
),
"deviceinfo" OBJECT(DYNAMIC) AS (
"devicetype" TEXT,
"hwversion" TEXT,
"id" TEXT,
"msgno" TEXT,
"rcvddts" TEXT,
"swversion" TEXT
),
"epf" OBJECT(DYNAMIC) AS (
"endtime" BIGINT,
"epfduration" BIGINT,
"epfstatus" BIGINT,
"noofevent" BIGINT,
"starttime" BIGINT,
"uid" TEXT
),
"gpsinfo" OBJECT(DYNAMIC) AS (
"altitude" TEXT,
"arialodometer" TEXT,
"course" TEXT,
"deviceodometer" TEXT,
"distance" TEXT,
"geofence" ARRAY(OBJECT(DYNAMIC) AS (
"address" OBJECT(DYNAMIC) AS (
"addressLine1" TEXT,
"addressLine2" TEXT,
"city" TEXT,
"country" TEXT,
"district" TEXT,
"pincode" TEXT,
"state" TEXT
),
"citycode" TEXT,
"hierarchyPath" TEXT,
"id" BIGINT,
"loctype" TEXT,
"name" TEXT
)),
"geofenceDO" ARRAY(OBJECT(DYNAMIC) AS (
"address" TEXT,
"citycode" TEXT,
"companyid" BIGINT,
"hierarchyPath" TEXT,
"id" BIGINT,
"loctype" TEXT,
"name" TEXT
)),
"gpsdttime" TEXT,
"gpsmode" TEXT,
"gpsvalidity" TEXT,
"lat" TEXT,
"location" TEXT,
"lon" TEXT,
"noofsatellite" TEXT,
"odometer" TEXT,
"packetStatus" TEXT,
"poi" OBJECT(DYNAMIC) AS (
"address" OBJECT(DYNAMIC) AS (
"addressLine1" TEXT,
"addressLine2" TEXT,
"city" TEXT,
"country" TEXT,
"district" TEXT,
"pincode" TEXT,
"state" TEXT
),
"distance" REAL,
"location" TEXT
),
"speed" TEXT
),
"idling" OBJECT(DYNAMIC) AS (
"arialDistance" REAL,
"endtime" BIGINT,
"idlingduration" BIGINT,
"idlingstatus" BIGINT,
"noofevent" BIGINT,
"starttime" BIGINT,
"uid" TEXT
),
"operatorinfo" OBJECT(DYNAMIC) AS (
"cgreg" TEXT,
"creg" TEXT,
"csq" TEXT,
"imsi" TEXT,
"nwop" TEXT
),
"power" OBJECT(DYNAMIC) AS (
"batterystatus" TEXT,
"batteryvoltage" TEXT,
"mainstatus" TEXT,
"mainvoltage" TEXT
)
),
"week" TIMESTAMP WITHOUT TIME ZONE GENERATED ALWAYS AS CAST(date_trunc('week', "tsdbtime") AS timestamp without time zone),
"insertiontime" TIMESTAMP WITHOUT TIME ZONE
)
CLUSTERED INTO 6 SHARDS
PARTITIONED BY ("week")
WITH (
"allocation.max_retries" = 5,
"blocks.metadata" = false,
"blocks.read" = false,
"blocks.read_only" = false,
"blocks.read_only_allow_delete" = false,
"blocks.write" = false,
codec = 'default',
column_policy = 'strict',
"mapping.total_fields.limit" = 1000,
max_ngram_diff = 1,
max_shingle_diff = 3,
number_of_replicas = '0-1',
refresh_interval = 1000,
"routing.allocation.enable" = 'all',
"routing.allocation.total_shards_per_node" = -1,
"store.type" = 'fs',
"translog.durability" = 'ASYNC',
"translog.flush_threshold_size" = 536870912,
"translog.sync_interval" = 5000,
"unassigned.node_left.delayed_timeout" = 60000,
"warmer.enabled" = true,
"write.wait_for_active_shards" = '1'
)