54 lines
999 B
PL/PgSQL
54 lines
999 B
PL/PgSQL
|
|
-- Sequence: public.track_id_seq
|
|
|
|
-- DROP SEQUENCE public.track_id_seq;
|
|
|
|
CREATE SEQUENCE public.track_id_seq
|
|
INCREMENT 1
|
|
MINVALUE 1
|
|
MAXVALUE 9223372036854775807
|
|
START 1
|
|
CACHE 1;
|
|
ALTER TABLE public.track_id_seq
|
|
OWNER TO postgres;
|
|
|
|
|
|
|
|
-- Table: public.track
|
|
|
|
-- DROP TABLE public.track;
|
|
|
|
CREATE TABLE public.track
|
|
(
|
|
id bigint NOT NULL DEFAULT nextval('track_id_seq'::regclass),
|
|
locationid integer,
|
|
logged timestamp with time zone,
|
|
count smallint,
|
|
total integer
|
|
)
|
|
WITH (
|
|
OIDS=FALSE
|
|
);
|
|
ALTER TABLE public.track
|
|
OWNER TO postgres;
|
|
|
|
|
|
--
|
|
|
|
CREATE OR REPLACE FUNCTION public.insert_track(
|
|
_locationid integer,
|
|
_logged timestamp with time zone,
|
|
_count smallint,
|
|
_total integer)
|
|
RETURNS void AS
|
|
$BODY$
|
|
|
|
BEGIN
|
|
INSERT into track(locationid, logged, count, total) Values( _locationid, _logged, _count, _total);
|
|
END;
|
|
$BODY$
|
|
LANGUAGE plpgsql VOLATILE
|
|
COST 100;
|
|
ALTER FUNCTION public.insert_track(integer, timestamp with time zone, smallint, integer)
|
|
OWNER TO postgres;
|