-
Notifications
You must be signed in to change notification settings - Fork 0
/
ad_manager_database.sql
122 lines (88 loc) · 2.69 KB
/
ad_manager_database.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
--
-- PostgreSQL database dump
--
-- Dumped from database version 13.1
-- Dumped by pg_dump version 13.1
-- Started on 2021-01-15 15:02:11
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- TOC entry 201 (class 1259 OID 16429)
-- Name: ad; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.ad (
id integer NOT NULL,
title character varying(100),
img_url text,
link text,
advertiser_id integer NOT NULL,
clicks integer DEFAULT 0 NOT NULL,
views integer DEFAULT 0 NOT NULL
);
ALTER TABLE public.ad OWNER TO postgres;
--
-- TOC entry 200 (class 1259 OID 16422)
-- Name: advertiser; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.advertiser (
id integer NOT NULL,
name character varying(50),
clicks integer DEFAULT 0 NOT NULL,
views integer DEFAULT 0 NOT NULL
);
ALTER TABLE public.advertiser OWNER TO postgres;
--
-- TOC entry 2994 (class 0 OID 16429)
-- Dependencies: 201
-- Data for Name: ad; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.ad (id, title, img_url, link, advertiser_id, clicks, views) FROM stdin;
1 title1 img_url1 link1 1 0 0
2 title2 img_url2 link2 2 0 0
\.
--
-- TOC entry 2993 (class 0 OID 16422)
-- Dependencies: 200
-- Data for Name: advertiser; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.advertiser (id, name, clicks, views) FROM stdin;
1 name1 0 0
2 name2 0 0
\.
--
-- TOC entry 2860 (class 2606 OID 16438)
-- Name: ad ad_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.ad
ADD CONSTRAINT ad_pkey PRIMARY KEY (id);
--
-- TOC entry 2858 (class 2606 OID 16428)
-- Name: advertiser advertiser_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.advertiser
ADD CONSTRAINT advertiser_pkey PRIMARY KEY (id);
--
-- TOC entry 2861 (class 1259 OID 16444)
-- Name: fki_advertiser_fkey; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX fki_advertiser_fkey ON public.ad USING btree (advertiser_id);
--
-- TOC entry 2862 (class 2606 OID 16439)
-- Name: ad advertiser_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.ad
ADD CONSTRAINT advertiser_fkey FOREIGN KEY (advertiser_id) REFERENCES public.advertiser(id) NOT VALID;
-- Completed on 2021-01-15 15:02:11
--
-- PostgreSQL database dump complete
--