Skip to content

Instantly share code, notes, and snippets.

@c1982
Created February 28, 2018 16:29
Show Gist options
  • Save c1982/dd1426dfd3e8fbe3879c3d35e5e7af72 to your computer and use it in GitHub Desktop.
Save c1982/dd1426dfd3e8fbe3879c3d35e5e7af72 to your computer and use it in GitHub Desktop.
CREATE DATABASE orderevents
WITH
OWNER = postgres
ENCODING = 'UTF8'
LC_COLLATE = 'Turkish_Turkey.1254'
LC_CTYPE = 'Turkish_Turkey.1254'
TABLESPACE = pg_default
CONNECTION LIMIT = -1;
CREATE TABLE public."order"
(
id uuid NOT NULL,
symbol text COLLATE pg_catalog."default",
price numeric,
quantity bigint,
status smallint,
created date,
CONSTRAINT order_pkey PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public."order"
OWNER to postgres;
-- Table: public.order_log
-- DROP TABLE public.order_log;
CREATE TABLE public.order_log
(
id bigint NOT NULL,
"orderID" uuid,
action text COLLATE pg_catalog."default",
occured date,
CONSTRAINT order_log_pkey PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.order_log
OWNER to postgres;
-- Table: public.orderevents
-- DROP TABLE public.orderevents;
CREATE TABLE public.orderevents
(
id bigint NOT NULL,
source_id text COLLATE pg_catalog."default" NOT NULL,
created date,
event_type text COLLATE pg_catalog."default",
version integer,
payload text COLLATE pg_catalog."default",
CONSTRAINT orderevents_pkey PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.orderevents
OWNER to postgres;
-- Table: public."position"
-- DROP TABLE public."position";
CREATE TABLE public."position"
(
id bigint NOT NULL,
symbol text COLLATE pg_catalog."default",
quantity integer,
updated date,
CONSTRAINT position_pkey PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public."position"
OWNER to postgres;
-- Table: public.trade
-- DROP TABLE public.trade;
CREATE TABLE public.trade
(
id bigint NOT NULL,
"orderID" uuid,
price numeric,
quantity numeric,
occured date,
CONSTRAINT trade_pkey PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.trade
OWNER to postgres;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment