

-- ***************************  INSTRUCTIONS TO IMPORT THE SCHEMA    ****************************

-- using Find/Replace All, replace the ocurrences of jfaria in the orginal dump file by your login in PostgreSQL (e.g. INFI202175)
-- save the modified file

-- Sign In PostgreSQL with your account (e.g. INFI202175)
-- Click on Schemas
-- Click SQL (link in the top right corner of the page)
-- Paste the content of the modified dump file in the SQL window
-- Click in Execute to run the script

-- Attention:
-- If you already have a schema named testsinfi in your account, you should delete or rename it before you run the script. 
-- Otherwise, you'll get an error.

-----------------------------------------------------------------------------


--
-- PostgreSQL database dump
--

-- Dumped from database version 9.6.20
-- Dumped by pg_dump version 9.6.20

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;

--
-- Name: testsinfi; Type: SCHEMA; Schema: -; Owner: jfaria
--

CREATE SCHEMA testsinfi;


ALTER SCHEMA testsinfi OWNER TO jfaria;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: countries; Type: TABLE; Schema: testsinfi; Owner: jfaria
--

CREATE TABLE testsinfi.countries (
    id integer NOT NULL,
    name character varying(15)
);


ALTER TABLE testsinfi.countries OWNER TO jfaria;

--
-- Name: countries_id_seq; Type: SEQUENCE; Schema: testsinfi; Owner: jfaria
--

CREATE SEQUENCE testsinfi.countries_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE testsinfi.countries_id_seq OWNER TO jfaria;

--
-- Name: countries_id_seq; Type: SEQUENCE OWNED BY; Schema: testsinfi; Owner: jfaria
--

ALTER SEQUENCE testsinfi.countries_id_seq OWNED BY testsinfi.countries.id;


--
-- Name: friends; Type: TABLE; Schema: testsinfi; Owner: jfaria
--

CREATE TABLE testsinfi.friends (
    id integer NOT NULL,
    name character varying(15),
    age integer,
    country integer
);


ALTER TABLE testsinfi.friends OWNER TO jfaria;

--
-- Name: friends_id_seq; Type: SEQUENCE; Schema: testsinfi; Owner: jfaria
--

CREATE SEQUENCE testsinfi.friends_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE testsinfi.friends_id_seq OWNER TO jfaria;

--
-- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: testsinfi; Owner: jfaria
--

ALTER SEQUENCE testsinfi.friends_id_seq OWNED BY testsinfi.friends.id;


--
-- Name: countries id; Type: DEFAULT; Schema: testsinfi; Owner: jfaria
--

ALTER TABLE ONLY testsinfi.countries ALTER COLUMN id SET DEFAULT nextval('testsinfi.countries_id_seq'::regclass);


--
-- Name: friends id; Type: DEFAULT; Schema: testsinfi; Owner: jfaria
--

ALTER TABLE ONLY testsinfi.friends ALTER COLUMN id SET DEFAULT nextval('testsinfi.friends_id_seq'::regclass);


--
-- Data for Name: countries; Type: TABLE DATA; Schema: testsinfi; Owner: jfaria
--

INSERT INTO testsinfi.countries VALUES (1, 'Portugal');
INSERT INTO testsinfi.countries VALUES (2, 'Spain');
INSERT INTO testsinfi.countries VALUES (3, 'France');
INSERT INTO testsinfi.countries VALUES (4, 'UK');


--
-- Name: countries_id_seq; Type: SEQUENCE SET; Schema: testsinfi; Owner: jfaria
--

SELECT pg_catalog.setval('testsinfi.countries_id_seq', 4, true);


--
-- Data for Name: friends; Type: TABLE DATA; Schema: testsinfi; Owner: jfaria
--

INSERT INTO testsinfi.friends VALUES (1, 'Pablo', 24, 2);
INSERT INTO testsinfi.friends VALUES (3, 'Luis', 30, 1);
INSERT INTO testsinfi.friends VALUES (5, 'John', 26, 4);
INSERT INTO testsinfi.friends VALUES (6, 'Carolina', 27, 1);
INSERT INTO testsinfi.friends VALUES (7, 'John', 24, 4);
INSERT INTO testsinfi.friends VALUES (4, 'John', 24, 4);
INSERT INTO testsinfi.friends VALUES (2, 'Claire', 21, 3);


--
-- Name: friends_id_seq; Type: SEQUENCE SET; Schema: testsinfi; Owner: jfaria
--

SELECT pg_catalog.setval('testsinfi.friends_id_seq', 8, true);


--
-- Name: countries countries_pkey; Type: CONSTRAINT; Schema: testsinfi; Owner: jfaria
--

ALTER TABLE ONLY testsinfi.countries
    ADD CONSTRAINT countries_pkey PRIMARY KEY (id);


--
-- Name: friends friends_pkey; Type: CONSTRAINT; Schema: testsinfi; Owner: jfaria
--

ALTER TABLE ONLY testsinfi.friends
    ADD CONSTRAINT friends_pkey PRIMARY KEY (id);


--
-- Name: friends friends_country_fkey; Type: FK CONSTRAINT; Schema: testsinfi; Owner: jfaria
--

ALTER TABLE ONLY testsinfi.friends
    ADD CONSTRAINT friends_country_fkey FOREIGN KEY (country) REFERENCES testsinfi.countries(id);


--
-- PostgreSQL database dump complete
--

