--
-- PostgreSQL database dump
--

-- Dumped from database version 12.1
-- Dumped by pg_dump version 12.1

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;

--
-- Name: character; Type: TABLE; Schema: public; Owner: rpfw-dev
--

CREATE TABLE public."character" (
    id integer NOT NULL,
    user_id integer NOT NULL,
    name character varying(24) NOT NULL,
    skin_id smallint DEFAULT 134 NOT NULL,
    cash integer DEFAULT 0,
    health real DEFAULT 100,
    armour real DEFAULT 100,
    jailed smallint DEFAULT 0,
    pos_x real DEFAULT '-144.0328'::numeric,
    pos_y real DEFAULT 1225.0564,
    pos_z real DEFAULT 19.8992,
    rotation real DEFAULT 175.5507,
    created timestamp without time zone DEFAULT (now())::timestamp without time zone,
    job_id smallint DEFAULT 0 NOT NULL
);
ALTER TABLE ONLY public."character" ALTER COLUMN job_id SET (n_distinct=0);


ALTER TABLE public."character" OWNER TO "rpfw-dev";

--
-- Name: TABLE "character"; Type: COMMENT; Schema: public; Owner: rpfw-dev
--

COMMENT ON TABLE public."character" IS 'A character of a user. A user can have multiple characters, limited in the game-mode by the charaterArray size, which is set to the definition MAX_CHARACTERS_PER_USER in the game-mode limits section.';


--
-- Name: COLUMN "character".jailed; Type: COMMENT; Schema: public; Owner: rpfw-dev
--

COMMENT ON COLUMN public."character".jailed IS 'Amount of minutes jailed.
TODO Move to own table for criminal database';


--
-- Name: character_character_id_seq; Type: SEQUENCE; Schema: public; Owner: rpfw-dev
--

CREATE SEQUENCE public.character_character_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.character_character_id_seq OWNER TO "rpfw-dev";

--
-- Name: character_id_seq; Type: SEQUENCE; Schema: public; Owner: rpfw-dev
--

CREATE SEQUENCE public.character_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.character_id_seq OWNER TO "rpfw-dev";

--
-- Name: character_id_seq1; Type: SEQUENCE; Schema: public; Owner: rpfw-dev
--

CREATE SEQUENCE public.character_id_seq1
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.character_id_seq1 OWNER TO "rpfw-dev";

--
-- Name: character_id_seq1; Type: SEQUENCE OWNED BY; Schema: public; Owner: rpfw-dev
--

ALTER SEQUENCE public.character_id_seq1 OWNED BY public."character".id;


--
-- Name: ip; Type: TABLE; Schema: public; Owner: rpfw-dev
--

CREATE TABLE public.ip (
    id integer NOT NULL,
    address character varying(45) NOT NULL,
    connections integer DEFAULT 1
);


ALTER TABLE public.ip OWNER TO "rpfw-dev";

--
-- Name: COLUMN ip.address; Type: COMMENT; Schema: public; Owner: rpfw-dev
--

COMMENT ON COLUMN public.ip.address IS 'Even though sa-mp only seems to support IPv4.
It''s not likely to be updated, but if so, the database is ready for the "future".';


--
-- Name: ip_ban; Type: TABLE; Schema: public; Owner: rpfw-dev
--

CREATE TABLE public.ip_ban (
    id integer NOT NULL,
    ip_id integer NOT NULL,
    created timestamp without time zone DEFAULT (now())::timestamp without time zone,
    expires timestamp without time zone DEFAULT ((now())::timestamp without time zone + '30 days'::interval),
    reason character varying(121) NOT NULL,
    banner_id integer
);


ALTER TABLE public.ip_ban OWNER TO "rpfw-dev";

--
-- Name: TABLE ip_ban; Type: COMMENT; Schema: public; Owner: rpfw-dev
--

COMMENT ON TABLE public.ip_ban IS 'Ban records per IP.
Historic bans are kept for administrative purposes & active bans are checked against timestamp.';


--
-- Name: COLUMN ip_ban.reason; Type: COMMENT; Schema: public; Owner: rpfw-dev
--

COMMENT ON COLUMN public.ip_ban.reason IS 'Maximum sa-mp message length = 128.
The shortest possible ban command is "/ban 0 ". (7 characters)
128 - 7 = 121 as maximum ban reason.';


--
-- Name: ip_bans_id_seq; Type: SEQUENCE; Schema: public; Owner: rpfw-dev
--

CREATE SEQUENCE public.ip_bans_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.ip_bans_id_seq OWNER TO "rpfw-dev";

--
-- Name: ip_bans_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: rpfw-dev
--

ALTER SEQUENCE public.ip_bans_id_seq OWNED BY public.ip_ban.id;


--
-- Name: ip_id_seq; Type: SEQUENCE; Schema: public; Owner: rpfw-dev
--

CREATE SEQUENCE public.ip_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.ip_id_seq OWNER TO "rpfw-dev";

--
-- Name: ip_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: rpfw-dev
--

ALTER SEQUENCE public.ip_id_seq OWNED BY public.ip.id;


--
-- Name: ip_ip_id_seq; Type: SEQUENCE; Schema: public; Owner: rpfw-dev
--

CREATE SEQUENCE public.ip_ip_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.ip_ip_id_seq OWNER TO "rpfw-dev";

--
-- Name: ip_kick; Type: TABLE; Schema: public; Owner: rpfw-dev
--

CREATE TABLE public.ip_kick (
    id integer NOT NULL,
    ip_id integer NOT NULL,
    created timestamp without time zone DEFAULT (now())::timestamp without time zone NOT NULL,
    reason character varying(121) NOT NULL,
    kicker_id integer
);


ALTER TABLE public.ip_kick OWNER TO "rpfw-dev";

--
-- Name: ip_kick_id_seq; Type: SEQUENCE; Schema: public; Owner: rpfw-dev
--

CREATE SEQUENCE public.ip_kick_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.ip_kick_id_seq OWNER TO "rpfw-dev";

--
-- Name: ip_kick_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: rpfw-dev
--

ALTER SEQUENCE public.ip_kick_id_seq OWNED BY public.ip_kick.id;


--
-- Name: pickup; Type: TABLE; Schema: public; Owner: rpfw-dev
--

CREATE TABLE public.pickup (
    id integer NOT NULL,
    object_id smallint NOT NULL,
    pos_x real NOT NULL,
    pos_y real NOT NULL,
    pos_z real NOT NULL,
    world_id smallint NOT NULL,
    interior_id smallint NOT NULL,
    type_id smallint NOT NULL,
    pickup_id smallint
);


ALTER TABLE public.pickup OWNER TO "rpfw-dev";

--
-- Name: pickup_id_seq; Type: SEQUENCE; Schema: public; Owner: rpfw-dev
--

CREATE SEQUENCE public.pickup_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.pickup_id_seq OWNER TO "rpfw-dev";

--
-- Name: pickup_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: rpfw-dev
--

ALTER SEQUENCE public.pickup_id_seq OWNED BY public.pickup.id;


--
-- Name: portal; Type: TABLE; Schema: public; Owner: rpfw-dev
--

CREATE TABLE public.portal (
    id integer NOT NULL,
    object smallint NOT NULL,
    pos_x real NOT NULL,
    pos_y real NOT NULL,
    pos_z real NOT NULL,
    world smallint NOT NULL,
    exit_object smallint,
    exit_pos_x real,
    exit_pos_y real,
    exit_pos_z real,
    exit_world smallint,
    pickup_id smallint,
    exit_pickup_id smallint,
    interior_id smallint DEFAULT 0 NOT NULL,
    exit_interior_id smallint
);


ALTER TABLE public.portal OWNER TO "rpfw-dev";

--
-- Name: portal_id_seq; Type: SEQUENCE; Schema: public; Owner: rpfw-dev
--

CREATE SEQUENCE public.portal_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.portal_id_seq OWNER TO "rpfw-dev";

--
-- Name: portal_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: rpfw-dev
--

ALTER SEQUENCE public.portal_id_seq OWNED BY public.portal.id;


--
-- Name: user; Type: TABLE; Schema: public; Owner: rpfw-dev
--

CREATE TABLE public."user" (
    id integer NOT NULL,
    name character varying(24) NOT NULL,
    level smallint DEFAULT 1,
    password character varying(128) NOT NULL,
    webaccount_id integer,
    jailed smallint DEFAULT 0,
    created timestamp without time zone DEFAULT (now())::timestamp without time zone
);


ALTER TABLE public."user" OWNER TO "rpfw-dev";

--
-- Name: TABLE "user"; Type: COMMENT; Schema: public; Owner: rpfw-dev
--

COMMENT ON TABLE public."user" IS 'SA-MP player user records';


--
-- Name: user_ban; Type: TABLE; Schema: public; Owner: rpfw-dev
--

CREATE TABLE public.user_ban (
    id integer NOT NULL,
    user_id integer NOT NULL,
    created timestamp without time zone DEFAULT (now())::timestamp without time zone,
    expires timestamp without time zone DEFAULT ((now())::timestamp without time zone + '30 days'::interval),
    reason character varying(121) NOT NULL,
    banner integer,
    ip_ban_id integer
);


ALTER TABLE public.user_ban OWNER TO "rpfw-dev";

--
-- Name: COLUMN user_ban.banner; Type: COMMENT; Schema: public; Owner: rpfw-dev
--

COMMENT ON COLUMN public.user_ban.banner IS 'NOT NULL as users can be banned by automation as well as ingame players.';


--
-- Name: COLUMN user_ban.ip_ban_id; Type: COMMENT; Schema: public; Owner: rpfw-dev
--

COMMENT ON COLUMN public.user_ban.ip_ban_id IS 'Optional, as an IP ban might get removed for another user and we want the offending user to remain banned.';


--
-- Name: user_bans_id_seq; Type: SEQUENCE; Schema: public; Owner: rpfw-dev
--

CREATE SEQUENCE public.user_bans_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.user_bans_id_seq OWNER TO "rpfw-dev";

--
-- Name: user_bans_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: rpfw-dev
--

ALTER SEQUENCE public.user_bans_id_seq OWNED BY public.user_ban.id;


--
-- Name: user_id_seq; Type: SEQUENCE; Schema: public; Owner: rpfw-dev
--

CREATE SEQUENCE public.user_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.user_id_seq OWNER TO "rpfw-dev";

--
-- Name: user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: rpfw-dev
--

ALTER SEQUENCE public.user_id_seq OWNED BY public."user".id;


--
-- Name: user_ip; Type: TABLE; Schema: public; Owner: rpfw-dev
--

CREATE TABLE public.user_ip (
    ip_id integer NOT NULL,
    user_id integer NOT NULL,
    updated timestamp without time zone DEFAULT (now())::timestamp without time zone NOT NULL,
    created timestamp without time zone NOT NULL
);


ALTER TABLE public.user_ip OWNER TO "rpfw-dev";

--
-- Name: COLUMN user_ip.updated; Type: COMMENT; Schema: public; Owner: rpfw-dev
--

COMMENT ON COLUMN public.user_ip.updated IS 'For administration purposes it might be usefull to see when a user last used an IP.';


--
-- Name: COLUMN user_ip.created; Type: COMMENT; Schema: public; Owner: rpfw-dev
--

COMMENT ON COLUMN public.user_ip.created IS 'For administration purposes it might be usefull to see when a user started using an IP.';


--
-- Name: user_kick; Type: TABLE; Schema: public; Owner: rpfw-dev
--

CREATE TABLE public.user_kick (
    id integer NOT NULL,
    user_id integer NOT NULL,
    created timestamp without time zone DEFAULT (now())::timestamp without time zone,
    reason character varying(121) NOT NULL,
    kicker_id integer,
    ip_kick_id integer NOT NULL
);


ALTER TABLE public.user_kick OWNER TO "rpfw-dev";

--
-- Name: user_kicks_id_seq; Type: SEQUENCE; Schema: public; Owner: rpfw-dev
--

CREATE SEQUENCE public.user_kicks_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.user_kicks_id_seq OWNER TO "rpfw-dev";

--
-- Name: user_kicks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: rpfw-dev
--

ALTER SEQUENCE public.user_kicks_id_seq OWNED BY public.user_kick.id;


--
-- Name: user_user_id_seq; Type: SEQUENCE; Schema: public; Owner: rpfw-dev
--

CREATE SEQUENCE public.user_user_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.user_user_id_seq OWNER TO "rpfw-dev";

--
-- Name: character id; Type: DEFAULT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public."character" ALTER COLUMN id SET DEFAULT nextval('public.character_id_seq1'::regclass);


--
-- Name: ip id; Type: DEFAULT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.ip ALTER COLUMN id SET DEFAULT nextval('public.ip_id_seq'::regclass);


--
-- Name: ip_ban id; Type: DEFAULT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.ip_ban ALTER COLUMN id SET DEFAULT nextval('public.ip_bans_id_seq'::regclass);


--
-- Name: ip_kick id; Type: DEFAULT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.ip_kick ALTER COLUMN id SET DEFAULT nextval('public.ip_kick_id_seq'::regclass);


--
-- Name: pickup id; Type: DEFAULT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.pickup ALTER COLUMN id SET DEFAULT nextval('public.pickup_id_seq'::regclass);


--
-- Name: portal id; Type: DEFAULT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.portal ALTER COLUMN id SET DEFAULT nextval('public.portal_id_seq'::regclass);


--
-- Name: user id; Type: DEFAULT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public."user" ALTER COLUMN id SET DEFAULT nextval('public.user_id_seq'::regclass);


--
-- Name: user_ban id; Type: DEFAULT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.user_ban ALTER COLUMN id SET DEFAULT nextval('public.user_bans_id_seq'::regclass);


--
-- Name: user_kick id; Type: DEFAULT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.user_kick ALTER COLUMN id SET DEFAULT nextval('public.user_kicks_id_seq'::regclass);


--
-- Data for Name: character; Type: TABLE DATA; Schema: public; Owner: rpfw-dev
--

COPY public."character" (id, user_id, name, skin_id, cash, health, armour, jailed, pos_x, pos_y, pos_z, rotation, created, job_id) FROM stdin;
24	10	Jo_Bo	134	0	100	0	0	-199.20834	1010.5281	19.58448	288.98694	2020-02-17 17:09:01.880547	0
31	11	Do_Do	239	0	100	0	0	-26	-55	967.53326	0	2020-02-19 00:55:47.737857	0
30	11	Test_Boy	162	0	100	0	0	-124	1224	18.715376	181.99998	2020-02-18 20:12:49.737771	0
26	11	Cybernetic_Organism	239	0	100	0	0	633.4422	-572.36035	16.335938	77.659065	2020-02-17 20:54:28.806242	0
\.


--
-- Data for Name: ip; Type: TABLE DATA; Schema: public; Owner: rpfw-dev
--

COPY public.ip (id, address, connections) FROM stdin;
49	127.0.0.1	176
\.


--
-- Data for Name: ip_ban; Type: TABLE DATA; Schema: public; Owner: rpfw-dev
--

COPY public.ip_ban (id, ip_id, created, expires, reason, banner_id) FROM stdin;
\.


--
-- Data for Name: ip_kick; Type: TABLE DATA; Schema: public; Owner: rpfw-dev
--

COPY public.ip_kick (id, ip_id, created, reason, kicker_id) FROM stdin;
12	49	2020-02-18 02:29:56.536483	Banned: 	\N
13	49	2020-02-18 02:39:55.916765	Banned: 	\N
14	49	2020-02-18 02:42:51.436805	Test	\N
15	49	2020-02-18 03:24:18.315046	Logged in with banned account: 10	\N
16	49	2020-02-18 03:33:37.433026	Logged in with banned account: 10	\N
17	49	2020-02-18 03:51:26.905196	Logged in with banned account: 10	\N
18	49	2020-02-18 03:55:31.348177	Logged in with banned account: 10	\N
19	49	2020-02-18 04:01:07.793421	Logged in with banned account: 10	\N
\.


--
-- Data for Name: pickup; Type: TABLE DATA; Schema: public; Owner: rpfw-dev
--

COPY public.pickup (id, object_id, pos_x, pos_y, pos_z, world_id, interior_id, type_id, pickup_id) FROM stdin;
12	1247	-194.39711	1006.1888	19.789062	-1	0	1	5
13	1247	-197.59868	1003.9858	19.573677	-1	0	0	6
14	1247	-199.97002	1004.9718	19.57259	-1	0	3	7
15	1247	-199.62653	1007.9586	19.580376	-1	0	4	8
16	1247	-197.85818	1011.4754	19.586456	-1	0	0	9
10	1210	-196.66846	988.2066	19.34976	0	0	0	9
17	1247	-195.93428	1011.05383	19.589275	0	0	0	10
18	1247	-198.0064	1012.3908	19.586235	0	0	1	11
19	1247	-198.5907	1014.7511	19.585367	0	0	3	12
11	1247	-190.57033	1012.1714	19.59375	-1	0	0	12
20	1247	-185.65926	1011.0639	19.59375	-1	0	2	13
21	1247	-187.103	1004.15753	19.580944	-1	0	1	14
22	1247	-190.75302	1011.91144	19.59375	-1	0	0	15
\.


--
-- Data for Name: portal; Type: TABLE DATA; Schema: public; Owner: rpfw-dev
--

COPY public.portal (id, object, pos_x, pos_y, pos_z, world, exit_object, exit_pos_x, exit_pos_y, exit_pos_z, exit_world, pickup_id, exit_pickup_id, interior_id, exit_interior_id) FROM stdin;
37	19902	-193.28966	1021.7189	19.59375	-1	19607	-200.09566	1020.7182	19.583738	-1	1	2	0	0
\.


--
-- Data for Name: user; Type: TABLE DATA; Schema: public; Owner: rpfw-dev
--

COPY public."user" (id, name, level, password, webaccount_id, jailed, created) FROM stdin;
10	Player	6	DF3210C97BB5895B32A09C3CD9A905248FD2F34720711152C92EE6D1828E3122B0844C565536C5214B5F2C137FF638BD86F03EBC412DDDDD4018F968819BEEC0	\N	0	2020-02-17 17:09:01.874546
11	tBKwtWS	10	DF3210C97BB5895B32A09C3CD9A905248FD2F34720711152C92EE6D1828E3122B0844C565536C5214B5F2C137FF638BD86F03EBC412DDDDD4018F968819BEEC0	\N	0	2020-02-17 20:54:28.754239
12	tBK	1	DF3210C97BB5895B32A09C3CD9A905248FD2F34720711152C92EE6D1828E3122B0844C565536C5214B5F2C137FF638BD86F03EBC412DDDDD4018F968819BEEC0	\N	0	2020-02-19 14:48:30.093714
\.


--
-- Data for Name: user_ban; Type: TABLE DATA; Schema: public; Owner: rpfw-dev
--

COPY public.user_ban (id, user_id, created, expires, reason, banner, ip_ban_id) FROM stdin;
\.


--
-- Data for Name: user_ip; Type: TABLE DATA; Schema: public; Owner: rpfw-dev
--

COPY public.user_ip (ip_id, user_id, updated, created) FROM stdin;
\.


--
-- Data for Name: user_kick; Type: TABLE DATA; Schema: public; Owner: rpfw-dev
--

COPY public.user_kick (id, user_id, created, reason, kicker_id, ip_kick_id) FROM stdin;
10	10	2020-02-18 04:01:07.841424	Logged in with banned account: 10	\N	19
\.


--
-- Name: character_character_id_seq; Type: SEQUENCE SET; Schema: public; Owner: rpfw-dev
--

SELECT pg_catalog.setval('public.character_character_id_seq', 1, false);


--
-- Name: character_id_seq; Type: SEQUENCE SET; Schema: public; Owner: rpfw-dev
--

SELECT pg_catalog.setval('public.character_id_seq', 1, false);


--
-- Name: character_id_seq1; Type: SEQUENCE SET; Schema: public; Owner: rpfw-dev
--

SELECT pg_catalog.setval('public.character_id_seq1', 32, true);


--
-- Name: ip_bans_id_seq; Type: SEQUENCE SET; Schema: public; Owner: rpfw-dev
--

SELECT pg_catalog.setval('public.ip_bans_id_seq', 8, true);


--
-- Name: ip_id_seq; Type: SEQUENCE SET; Schema: public; Owner: rpfw-dev
--

SELECT pg_catalog.setval('public.ip_id_seq', 224, true);


--
-- Name: ip_ip_id_seq; Type: SEQUENCE SET; Schema: public; Owner: rpfw-dev
--

SELECT pg_catalog.setval('public.ip_ip_id_seq', 133, true);


--
-- Name: ip_kick_id_seq; Type: SEQUENCE SET; Schema: public; Owner: rpfw-dev
--

SELECT pg_catalog.setval('public.ip_kick_id_seq', 19, true);


--
-- Name: pickup_id_seq; Type: SEQUENCE SET; Schema: public; Owner: rpfw-dev
--

SELECT pg_catalog.setval('public.pickup_id_seq', 22, true);


--
-- Name: portal_id_seq; Type: SEQUENCE SET; Schema: public; Owner: rpfw-dev
--

SELECT pg_catalog.setval('public.portal_id_seq', 39, true);


--
-- Name: user_bans_id_seq; Type: SEQUENCE SET; Schema: public; Owner: rpfw-dev
--

SELECT pg_catalog.setval('public.user_bans_id_seq', 5, true);


--
-- Name: user_id_seq; Type: SEQUENCE SET; Schema: public; Owner: rpfw-dev
--

SELECT pg_catalog.setval('public.user_id_seq', 12, true);


--
-- Name: user_kicks_id_seq; Type: SEQUENCE SET; Schema: public; Owner: rpfw-dev
--

SELECT pg_catalog.setval('public.user_kicks_id_seq', 10, true);


--
-- Name: user_user_id_seq; Type: SEQUENCE SET; Schema: public; Owner: rpfw-dev
--

SELECT pg_catalog.setval('public.user_user_id_seq', 19, true);


--
-- Name: character character_name_key; Type: CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public."character"
    ADD CONSTRAINT character_name_key UNIQUE (name);


--
-- Name: character character_pkey; Type: CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public."character"
    ADD CONSTRAINT character_pkey PRIMARY KEY (id);


--
-- Name: ip ip_address_key; Type: CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.ip
    ADD CONSTRAINT ip_address_key UNIQUE (address);


--
-- Name: ip_ban ip_bans_pkey; Type: CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.ip_ban
    ADD CONSTRAINT ip_bans_pkey PRIMARY KEY (id);


--
-- Name: ip_kick ip_kick_pkey; Type: CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.ip_kick
    ADD CONSTRAINT ip_kick_pkey PRIMARY KEY (id);


--
-- Name: ip ip_pkey; Type: CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.ip
    ADD CONSTRAINT ip_pkey PRIMARY KEY (id);


--
-- Name: pickup pickup_pkey; Type: CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.pickup
    ADD CONSTRAINT pickup_pkey PRIMARY KEY (id);


--
-- Name: portal portal_pkey; Type: CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.portal
    ADD CONSTRAINT portal_pkey PRIMARY KEY (id);


--
-- Name: portal unique_location; Type: CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.portal
    ADD CONSTRAINT unique_location UNIQUE (pos_x, pos_y, pos_z, world);


--
-- Name: user_ban user_bans_pkey; Type: CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.user_ban
    ADD CONSTRAINT user_bans_pkey PRIMARY KEY (id);


--
-- Name: user_ip user_ip_pkey; Type: CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.user_ip
    ADD CONSTRAINT user_ip_pkey PRIMARY KEY (ip_id, user_id);


--
-- Name: user_kick user_kicks_pkey; Type: CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.user_kick
    ADD CONSTRAINT user_kicks_pkey PRIMARY KEY (id);


--
-- Name: user user_name_key; Type: CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public."user"
    ADD CONSTRAINT user_name_key UNIQUE (name);


--
-- Name: user user_pkey; Type: CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public."user"
    ADD CONSTRAINT user_pkey PRIMARY KEY (id);


--
-- Name: character character_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public."character"
    ADD CONSTRAINT character_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: user_ban ip_ban_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.user_ban
    ADD CONSTRAINT ip_ban_id_fkey FOREIGN KEY (ip_ban_id) REFERENCES public.ip_ban(id) ON UPDATE CASCADE NOT VALID;


--
-- Name: CONSTRAINT ip_ban_id_fkey ON user_ban; Type: COMMENT; Schema: public; Owner: rpfw-dev
--

COMMENT ON CONSTRAINT ip_ban_id_fkey ON public.user_ban IS 'IP ban can be removed while character ban remains';


--
-- Name: ip_ban ip_bans_banner_fkey; Type: FK CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.ip_ban
    ADD CONSTRAINT ip_bans_banner_fkey FOREIGN KEY (banner_id) REFERENCES public."user"(id) ON UPDATE CASCADE;


--
-- Name: ip_ban ip_bans_ip_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.ip_ban
    ADD CONSTRAINT ip_bans_ip_id_fkey FOREIGN KEY (ip_id) REFERENCES public.ip(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: ip_kick ip_kick_ip_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.ip_kick
    ADD CONSTRAINT ip_kick_ip_id_fkey FOREIGN KEY (ip_id) REFERENCES public.ip(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: ip_kick ip_kick_kicker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.ip_kick
    ADD CONSTRAINT ip_kick_kicker_id_fkey FOREIGN KEY (kicker_id) REFERENCES public."user"(id) ON UPDATE CASCADE;


--
-- Name: user_ban user_bans_banner_fkey; Type: FK CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.user_ban
    ADD CONSTRAINT user_bans_banner_fkey FOREIGN KEY (banner) REFERENCES public."user"(id) ON UPDATE CASCADE;


--
-- Name: user_ban user_bans_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.user_ban
    ADD CONSTRAINT user_bans_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: user_ip user_ip_ip_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.user_ip
    ADD CONSTRAINT user_ip_ip_id_fkey FOREIGN KEY (ip_id) REFERENCES public.ip(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: user_ip user_ip_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.user_ip
    ADD CONSTRAINT user_ip_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: user_kick user_kick_ip_kick_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.user_kick
    ADD CONSTRAINT user_kick_ip_kick_id_fkey FOREIGN KEY (ip_kick_id) REFERENCES public.ip_kick(id) NOT VALID;


--
-- Name: user_kick user_kick_kicker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.user_kick
    ADD CONSTRAINT user_kick_kicker_id_fkey FOREIGN KEY (kicker_id) REFERENCES public."user"(id) ON UPDATE CASCADE;


--
-- Name: user_kick user_kick_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: rpfw-dev
--

ALTER TABLE ONLY public.user_kick
    ADD CONSTRAINT user_kick_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- PostgreSQL database dump complete
--

