org.postgresql.Driver jdbc:postgresql:traccar postgres postgres 300 CREATE SEQUENCE devicesSQ START 1 INCREMENT 1; CREATE SEQUENCE positionsSQ START 1 INCREMENT 1; CREATE TABLE devices (id int8 NOT NULL,imei varchar(16) NOT NULL,phonenumber varchar(255),uniqueid varchar(255),CONSTRAINT devices_pkey PRIMARY KEY (id)) WITH (OIDS=FALSE); ALTER TABLE devices OWNER TO postgres; CREATE TABLE positions (id int8 NOT NULL,address varchar(255),altitude float8,course float8,extendedinfo varchar(255),latitude float8 NOT NULL,longitude float8 NOT NULL,power float8 NOT NULL,speed float8,"time" timestamp NOT NULL,"valid" bool,device_id int8 NOT NULL,"mode" int4,CONSTRAINT positions_pkey PRIMARY KEY (id),CONSTRAINT fk_device FOREIGN KEY (device_id) REFERENCES devices (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION) WITH (OIDS=FALSE); ALTER TABLE positions OWNER TO postgres; id - Long imei - String <--> SELECT id, imei FROM devices imei - String <--> INSERT INTO devices (id,imei) VALUES (nextval('devicesSQ'),:imei) id - Long imei - String <--> UPDATE devices SET imei = :imei WHERE id = :id id - Long <--> DELETE FROM devices WHERE id = :id device_id - Long <--> SELECT * FROM positions WHERE device_id = :device_id device_id - Long time - Date valid - Boolean latitude - Double longitude - Double speed - Double course - Double power - Double (NULL for some protocols) mode - Integer extended_info - String (XML) <--> INSERT INTO positions (id, device_id, time, valid, latitude, longitude, speed, course, power, mode) VALUES (nextval('positionsSQ'),:device_id, :time, :valid, :latitude, :longitude, :speed, :course, :power, :mode) true 8082 true jornadaLOG false 5000 0 false 5001 0 false 5002 0 false 5003 0 false 5004 0 false 5005 0 false 5006 0 false 5007 0 false 5008 0 false 5009 0 true 8801 0