-- V1.1 (2022-11-04)
--DROP TABLE "VIRTAPORTAL"."EMP_TRANSACTIONS";
CREATE COLUMN TABLE "VIRTAPORTAL"."EMP_TRANSACTIONS"(
	"UUID" NVARCHAR(50) NOT NULL,
	"CDRID" NVARCHAR(50),
	"STATIONUUID" NVARCHAR(50),
	"CUSTOMERID" BIGINT CS_FIXED,
	"STARTTIME" NVARCHAR(50),
	"STOPTIME" NVARCHAR(50),
	"DURATION" INTEGER CS_INT,
	"WATTHOUR" INTEGER CS_INT,
	"AMOUNT" INTEGER CS_INT,
	"CURRENCY" NVARCHAR(3),
	"TRANSACTIONTYPE" NVARCHAR(50),
	"CREATED" NVARCHAR(50),
	"RFID" NVARCHAR(50),
	"STATION" NCLOB MEMORY THRESHOLD 1000,
	"STATION_ID" NVARCHAR(50),
	"STATION_NAME" NVARCHAR(100),
	"LOCATION_ID" INTEGER CS_INT,
	"LOCATION_ADDRESS" NVARCHAR(100),
	"LOCATION_CITY" NVARCHAR(100),
	"LOCATION_TYPE" NVARCHAR(50),
	"CUSTOMERGROUPID" NVARCHAR(50),
	"CUSTOMERGROUPNAME" NVARCHAR(100),
	"ORGANIZATIONID" NVARCHAR(50),
	"PAYMENTTYPE" NVARCHAR(50),
	"EVSEID" NVARCHAR(50),
	"PLUGTYPE" NVARCHAR(50),
	"EMPSHARE" INTEGER CS_INT,
	"SIGNEDMETERVALUEBEGIN" NVARCHAR(50),
	"SIGNEDMETERVALUEEND" NVARCHAR(50),
	"OPERATORPRICE" INTEGER CS_INT,
	"OPERATORCURRENCY" NVARCHAR(3),
	"OPERATORID" INTEGER CS_INT,
	"FREECHARGING" NVARCHAR(3),
	"EMPTARIFFID"  INTEGER CS_INT,
	"EMPTARIFFNAME"  NVARCHAR(100),
	"FULLEVSEID"  NVARCHAR(50),
	"METERSTART" INTEGER CS_INT,
	"METERSTOP" INTEGER CS_INT,
	"NOTES"  NVARCHAR(500),
	"MILEAGE"  INTEGER CS_INT,
	"JSONRAW" NCLOB MEMORY THRESHOLD 1000,
	"CREATE_TS" LONGDATE CS_LONGDATE DEFAULT CURRENT_TIMESTAMP NOT NULL,
	"UPDATE_TS" LONGDATE CS_LONGDATE NOT NULL,
	"STATUS" VARCHAR(1) DEFAULT 'N',
	"BILLING" VARCHAR(1) DEFAULT 'Y',
	PRIMARY KEY (
		"UUID"
	)
)
UNLOAD PRIORITY 5 AUTO MERGE;

ALTER TABLE "VIRTAPORTAL"."EMP_TRANSACTIONS" ALTER (
	 "EMPTARIFFNAME" NVARCHAR(100)
);



ALTER TABLE "VIRTAPORTAL"."EMP_TRANSACTIONS" ADD (
"CREATE_USER" NVARCHAR(50) DEFAULT CURRENT_USER NOT NULL
);


ALTER TABLE "VIRTAPORTAL"."EMP_TRANSACTIONS" ADD (
"UPDATE_USER" NVARCHAR(50) DEFAULT CURRENT_USER NOT NULL
);
