This repository has been archived by the owner on Apr 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
db.sql
61 lines (46 loc) · 1.76 KB
/
db.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
-- Table: public.total_count_record
-- DROP TABLE public.total_count_record;
CREATE TABLE public.total_count_record
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 0 MAXVALUE 2147483647 CACHE 1 ),
repo_id character(255) COLLATE pg_catalog."default" NOT NULL,
count integer NOT NULL DEFAULT 0,
CONSTRAINT total_count_record_pkey PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
-- Index: u_idx_repo_id
-- DROP INDEX public.u_idx_repo_id;
CREATE UNIQUE INDEX u_idx_repo_id
ON public.total_count_record USING btree
(repo_id COLLATE pg_catalog."default")
TABLESPACE pg_default;
COMMENT ON INDEX public.u_idx_repo_id
IS 'unique index for repo_id';
-- Table: public.current_day_count_record
-- DROP TABLE public.current_day_count_record;
CREATE TABLE public.current_day_count_record
(
visit_date character(8) COLLATE pg_catalog."default" NOT NULL,
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
repo_id character(255) COLLATE pg_catalog."default" NOT NULL,
count integer NOT NULL DEFAULT 0
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
COMMENT ON TABLE public.current_day_count_record
IS 'table for visitor count only in current day';
COMMENT ON COLUMN public.current_day_count_record.visit_date
IS 'visit date in format: YYYYMMDD';
-- Index: u_idx_repo_id_visit_date
-- DROP INDEX public.u_idx_repo_id_visit_date;
CREATE UNIQUE INDEX u_idx_repo_id_visit_date
ON public.current_day_count_record USING btree
(visit_date COLLATE pg_catalog."default", repo_id COLLATE pg_catalog."default")
TABLESPACE pg_default;
COMMENT ON INDEX public.u_idx_repo_id_visit_date
IS 'make repo_id and visit_date unique';