Menu

Database

Clemens Rath

The Open CarPool systems uses a PostGre SQL database in version 8.3

Here's the SQL code for the structure:

--
-- PostgreSQL database dump
--

SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- Name: dev_call2ride; Type: COMMENT; Schema: -; Owner: web
--

COMMENT ON DATABASE dev_call2ride IS 'Development Database for call2ride';

SET search_path = public, pg_catalog;

--
-- Name: enum_ride_status; Type: TYPE; Schema: public; Owner: call2ride
--

CREATE TYPE enum_ride_status AS ENUM (
'open',
'closed'
);

ALTER TYPE public.enum_ride_status OWNER TO call2ride;

--
-- Name: enum_route_status; Type: TYPE; Schema: public; Owner: call2ride
--

CREATE TYPE enum_route_status AS ENUM (
'enabled',
'disabled'
);

ALTER TYPE public.enum_route_status OWNER TO call2ride;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: ride_offers; Type: TABLE; Schema: public; Owner: call2ride; Tablespace:
--

CREATE TABLE ride_offers (
id integer NOT NULL,
user_number_id integer NOT NULL,
route_id integer NOT NULL,
start_time timestamp with time zone NOT NULL,
request_time timestamp with time zone DEFAULT now(),
status enum_ride_status NOT NULL,
reverse boolean
);

ALTER TABLE public.ride_offers OWNER TO call2ride;

--
-- Name: routes_seq; Type: SEQUENCE; Schema: public; Owner: web
--

CREATE SEQUENCE routes_seq
INCREMENT BY 1
MAXVALUE 100000
NO MINVALUE
CACHE 1;

ALTER TABLE public.routes_seq OWNER TO web;

--
-- Name: routes; Type: TABLE; Schema: public; Owner: call2ride; Tablespace:
--

CREATE TABLE routes (
id integer DEFAULT nextval('routes_seq'::regclass) NOT NULL,
origin character varying,
destination character varying,
status enum_route_status,
key character varying(3),
location_id integer,
user_id integer
);

ALTER TABLE public.routes OWNER TO call2ride;

--
-- Name: COLUMN routes.id; Type: COMMENT; Schema: public; Owner: call2ride
--

COMMENT ON COLUMN routes.id IS 'Unique identifyer, internal only, not to be confused with "key" which is the public route identifyer to be entered by the user';

--
-- Name: COLUMN routes.status; Type: COMMENT; Schema: public; Owner: call2ride
--

COMMENT ON COLUMN routes.status IS 'enabled/disabled';

--
-- Name: COLUMN routes.key; Type: COMMENT; Schema: public; Owner: call2ride
--

COMMENT ON COLUMN routes.key IS 'Key for identifying the route';

--
-- Name: COLUMN routes.location_id; Type: COMMENT; Schema: public; Owner: call2ride
--

COMMENT ON COLUMN routes.location_id IS 'the same routes keys can exist at multiple locations';

--
-- Name: COLUMN routes.user_id; Type: COMMENT; Schema: public; Owner: call2ride
--

COMMENT ON COLUMN routes.user_id IS 'NULL in case of public routes or set with a value in case of user-specific routes';

--
-- Name: status_log; Type: TABLE; Schema: public; Owner: call2ride; Tablespace:
--

CREATE TABLE status_log (
id integer NOT NULL,
ride_offer_id integer,
ride_requests_id integer,
old_status enum_ride_status,
new_status enum_ride_status,
change_time timestamp with time zone DEFAULT now()
);

ALTER TABLE public.status_log OWNER TO call2ride;

--
-- Name: users; Type: TABLE; Schema: public; Owner: call2ride; Tablespace:
--

CREATE TABLE users (
id integer NOT NULL,
name character varying,
is_active boolean,
email character varying(255),
company_id integer,
default_location_id integer,
password character varying(255),
group_id integer,
lost_password character varying(10)
);

ALTER TABLE public.users OWNER TO call2ride;

--
-- Name: analyses; Type: VIEW; Schema: public; Owner: web
--

CREATE VIEW analyses AS
SELECT CASE WHEN (ride_offers.id = status_log.ride_offer_id) THEN 'new offer'::text WHEN (ride_offers.id <> status_log.ride_offer_id) THEN 'offer'::text WHEN (ride_offers.id <> status_log.ride_offer_id) THEN 'updated offer'::text ELSE 'strange'::text END AS category FROM ride_offers, users, routes, status_log WHERE ((ride_offers.user_number_id = users.id) AND (ride_offers.route_id = routes.id)) ORDER BY ride_offers.start_time;

ALTER TABLE public.analyses OWNER TO web;

--
-- Name: VIEW analyses; Type: COMMENT; Schema: public; Owner: web
--

COMMENT ON VIEW analyses IS 'A View to review statistics.';

--
-- Name: analyses_offer; Type: VIEW; Schema: public; Owner: web
--

CREATE VIEW analyses_offer AS
SELECT routes.id AS route_id, CASE WHEN ((SELECT count(subt.user_number_id) AS count FROM ride_offers subt WHERE (((subt.user_number_id = ride_offers.user_number_id) AND (subt.route_id = ride_offers.route_id)) AND (subt.start_time < ride_offers.request_time))) > 0) THEN 'updated_offer'::text WHEN ((SELECT count(status_log.id) AS count FROM status_log WHERE (status_log.ride_offer_id = ride_offers.id)) > 0) THEN 'new_offer'::text ELSE 'closed_offer'::text END AS category FROM ride_offers, users, routes WHERE ((ride_offers.user_number_id = users.id) AND (ride_offers.route_id = routes.id));

ALTER TABLE public.analyses_offer OWNER TO web;

--
-- Name: VIEW analyses_offer; Type: COMMENT; Schema: public; Owner: web
--

COMMENT ON VIEW analyses_offer IS 'NOT TESTET, in my brain it should work';

--
-- Name: company; Type: TABLE; Schema: public; Owner: web; Tablespace:
--

CREATE TABLE company (
id integer NOT NULL,
name character varying(255)
);

ALTER TABLE public.company OWNER TO web;

--
-- Name: TABLE company; Type: COMMENT; Schema: public; Owner: web
--

COMMENT ON TABLE company IS 'Companies using call2ride';

--
-- Name: companies_id_seq; Type: SEQUENCE; Schema: public; Owner: web
--

CREATE SEQUENCE companies_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.companies_id_seq OWNER TO web;

--
-- Name: companies_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: web
--

ALTER SEQUENCE companies_id_seq OWNED BY company.id;

--
-- Name: error_log; Type: TABLE; Schema: public; Owner: web; Tablespace:
--

CREATE TABLE error_log (
id integer NOT NULL,
user_id integer,
code character varying(255),
message text,
"time" timestamp without time zone
);

ALTER TABLE public.error_log OWNER TO web;

--
-- Name: error_log_id_seq; Type: SEQUENCE; Schema: public; Owner: web
--

CREATE SEQUENCE error_log_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.error_log_id_seq OWNER TO web;

--
-- Name: error_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: web
--

ALTER SEQUENCE error_log_id_seq OWNED BY error_log.id;

--
-- Name: location; Type: TABLE; Schema: public; Owner: web; Tablespace:
--

CREATE TABLE location (
id integer NOT NULL,
company_id integer,
"Name" character varying(255),
timezone character varying(255)
);

ALTER TABLE public.location OWNER TO web;

--
-- Name: location_id_seq; Type: SEQUENCE; Schema: public; Owner: web
--

CREATE SEQUENCE location_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.location_id_seq OWNER TO web;

--
-- Name: location_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: web
--

ALTER SEQUENCE location_id_seq OWNED BY location.id;

--
-- Name: offer_status; Type: VIEW; Schema: public; Owner: web
--

CREATE VIEW offer_status AS
SELECT ride_offers.id AS offer_id, ride_offers.user_number_id AS user_id, ride_offers.route_id, ride_offers.start_time, ride_offers.request_time, date(ride_offers.request_time) AS offer_date, CASE WHEN ((SELECT count(subt.user_number_id) AS count FROM ride_offers subt WHERE ((((subt.user_number_id = ride_offers.user_number_id) AND (subt.route_id = ride_offers.route_id)) AND (date(subt.request_time) = date(ride_offers.request_time))) AND (subt.start_time >= ride_offers.start_time))) = (SELECT count(subt.user_number_id) AS count FROM ride_offers subt WHERE (((((subt.user_number_id = ride_offers.user_number_id) AND (subt.status = 'closed'::enum_ride_status)) AND (subt.route_id = ride_offers.route_id)) AND (date(subt.request_time) = date(ride_offers.request_time))) AND (subt.start_time >= ride_offers.start_time)))) THEN 'closed'::text WHEN ((SELECT count(subt.user_number_id) AS count FROM ride_offers subt WHERE ((((subt.user_number_id = ride_offers.user_number_id) AND (subt.route_id = ride_offers.route_id)) AND (date(subt.request_time) = date(ride_offers.request_time))) AND (subt.start_time >= ride_offers.start_time))) > 1) THEN 'updated'::text ELSE 'new'::text END AS status FROM ride_offers, users, routes WHERE ((ride_offers.user_number_id = users.id) AND (ride_offers.route_id = routes.id)) ORDER BY ride_offers.id;

ALTER TABLE public.offer_status OWNER TO web;

--
-- Name: pickuppoint; Type: TABLE; Schema: public; Owner: web; Tablespace:
--

CREATE TABLE pickuppoint (
id integer NOT NULL,
location_id integer,
name character varying(255),
geo character varying(255),
key character varying(3)
);

ALTER TABLE public.pickuppoint OWNER TO web;

--
-- Name: TABLE pickuppoint; Type: COMMENT; Schema: public; Owner: web
--

COMMENT ON TABLE pickuppoint IS 'Pickuppoints';

--
-- Name: pickuppoint_id_seq; Type: SEQUENCE; Schema: public; Owner: web
--

CREATE SEQUENCE pickuppoint_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.pickuppoint_id_seq OWNER TO web;

--
-- Name: pickuppoint_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: web
--

ALTER SEQUENCE pickuppoint_id_seq OWNED BY pickuppoint.id;

--
-- Name: pickuppoint_location_id_seq; Type: SEQUENCE; Schema: public; Owner: web
--

CREATE SEQUENCE pickuppoint_location_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.pickuppoint_location_id_seq OWNER TO web;

--
-- Name: pickuppoint_location_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: web
--

ALTER SEQUENCE pickuppoint_location_id_seq OWNED BY pickuppoint.location_id;

--
-- Name: public_transport; Type: TABLE; Schema: public; Owner: call2ride; Tablespace:
--

CREATE TABLE public_transport (
id integer NOT NULL,
route_id integer NOT NULL,
departure_time time without time zone NOT NULL,
arrival_time time without time zone NOT NULL,
means text,
start_point integer,
end_point integer
);

ALTER TABLE public.public_transport OWNER TO call2ride;

--
-- Name: COLUMN public_transport.route_id; Type: COMMENT; Schema: public; Owner: call2ride
--

COMMENT ON COLUMN public_transport.route_id IS 'is this still needed?';

--
-- Name: public_transport_id_seq; Type: SEQUENCE; Schema: public; Owner: call2ride
--

CREATE SEQUENCE public_transport_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.public_transport_id_seq OWNER TO call2ride;

--
-- Name: public_transport_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: call2ride
--

ALTER SEQUENCE public_transport_id_seq OWNED BY public_transport.id;

--
-- Name: ride_offers_id_seq; Type: SEQUENCE; Schema: public; Owner: call2ride
--

CREATE SEQUENCE ride_offers_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.ride_offers_id_seq OWNER TO call2ride;

--
-- Name: ride_offers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: call2ride
--

ALTER SEQUENCE ride_offers_id_seq OWNED BY ride_offers.id;

--
-- Name: ride_requests; Type: TABLE; Schema: public; Owner: call2ride; Tablespace:
--

CREATE TABLE ride_requests (
id integer NOT NULL,
earliest_start_time timestamp with time zone NOT NULL,
latest_start_time timestamp with time zone NOT NULL,
request_time timestamp with time zone DEFAULT now(),
status enum_ride_status NOT NULL,
start_point integer,
end_point integer,
user_number_id integer
);

ALTER TABLE public.ride_requests OWNER TO call2ride;

--
-- Name: ride_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: call2ride
--

CREATE SEQUENCE ride_requests_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.ride_requests_id_seq OWNER TO call2ride;

--
-- Name: ride_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: call2ride
--

ALTER SEQUENCE ride_requests_id_seq OWNED BY ride_requests.id;

--
-- Name: route_pickuppoint; Type: TABLE; Schema: public; Owner: web; Tablespace:
--

CREATE TABLE route_pickuppoint (
id integer NOT NULL,
route_id integer,
point_id integer,
steptime time without time zone,
"position" integer
);

ALTER TABLE public.route_pickuppoint OWNER TO web;

--
-- Name: COLUMN route_pickuppoint.route_id; Type: COMMENT; Schema: public; Owner: web
--

COMMENT ON COLUMN route_pickuppoint.route_id IS 'ID of the route. Unique only in combination with location ID and user ID';

--
-- Name: COLUMN route_pickuppoint.point_id; Type: COMMENT; Schema: public; Owner: web
--

COMMENT ON COLUMN route_pickuppoint.point_id IS 'ID of the pickuppoint';

--
-- Name: COLUMN route_pickuppoint.steptime; Type: COMMENT; Schema: public; Owner: web
--

COMMENT ON COLUMN route_pickuppoint.steptime IS 'time it takes to reach this point from the start point (static, should be dynamic vi TCM + route planner in future)';

--
-- Name: COLUMN route_pickuppoint."position"; Type: COMMENT; Schema: public; Owner: web
--

COMMENT ON COLUMN route_pickuppoint."position" IS 'determines the sequence of pickuppoints within a route';

--
-- Name: route_pickuppoint_id_seq; Type: SEQUENCE; Schema: public; Owner: web
--

CREATE SEQUENCE route_pickuppoint_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.route_pickuppoint_id_seq OWNER TO web;

--
-- Name: route_pickuppoint_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: web
--

ALTER SEQUENCE route_pickuppoint_id_seq OWNED BY route_pickuppoint.id;

--
-- Name: sms; Type: TABLE; Schema: public; Owner: call2ride; Tablespace:
--

CREATE TABLE sms (
id integer NOT NULL,
message text,
message_id character varying(20),
receiver_nr character varying(30),
cost numeric,
send_time timestamp with time zone DEFAULT now(),
error text
);

ALTER TABLE public.sms OWNER TO call2ride;

--
-- Name: sms_id_seq; Type: SEQUENCE; Schema: public; Owner: call2ride
--

CREATE SEQUENCE sms_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.sms_id_seq OWNER TO call2ride;

--
-- Name: sms_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: call2ride
--

ALTER SEQUENCE sms_id_seq OWNED BY sms.id;

--
-- Name: status_log_id_seq; Type: SEQUENCE; Schema: public; Owner: call2ride
--

CREATE SEQUENCE status_log_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.status_log_id_seq OWNER TO call2ride;

--
-- Name: status_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: call2ride
--

ALTER SEQUENCE status_log_id_seq OWNED BY status_log.id;

--
-- Name: taxi; Type: TABLE; Schema: public; Owner: call2ride; Tablespace:
--

CREATE TABLE taxi (
id integer NOT NULL,
number character varying(50),
location_id integer
);

ALTER TABLE public.taxi OWNER TO call2ride;

--
-- Name: taxi_id_seq; Type: SEQUENCE; Schema: public; Owner: call2ride
--

CREATE SEQUENCE taxi_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.taxi_id_seq OWNER TO call2ride;

--
-- Name: taxi_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: call2ride
--

ALTER SEQUENCE taxi_id_seq OWNED BY taxi.id;

--
-- Name: user_number; Type: TABLE; Schema: public; Owner: web; Tablespace:
--

CREATE TABLE user_number (
id integer NOT NULL,
user_id integer,
number character varying(255),
is_default boolean,
validation_code character varying(10),
is_active boolean
);

ALTER TABLE public.user_number OWNER TO web;

--
-- Name: user_numbers_id_seq; Type: SEQUENCE; Schema: public; Owner: web
--

CREATE SEQUENCE user_numbers_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.user_numbers_id_seq OWNER TO web;

--
-- Name: user_numbers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: web
--

ALTER SEQUENCE user_numbers_id_seq OWNED BY user_number.id;

--
-- Name: user_registration; Type: TABLE; Schema: public; Owner: web; Tablespace:
--

CREATE TABLE user_registration (
id integer NOT NULL,
name character varying NOT NULL,
cell_phone_nr character varying(50),
email character varying(255),
code_cell_phone character varying(20),
code_email character varying(20),
created timestamp with time zone,
status integer
);

ALTER TABLE public.user_registration OWNER TO web;

--
-- Name: TABLE user_registration; Type: COMMENT; Schema: public; Owner: web
--

COMMENT ON TABLE user_registration IS 'Data for the Registration Process';

--
-- Name: user_registration_id_seq; Type: SEQUENCE; Schema: public; Owner: web
--

CREATE SEQUENCE user_registration_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.user_registration_id_seq OWNER TO web;

--
-- Name: user_registration_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: web
--

ALTER SEQUENCE user_registration_id_seq OWNED BY user_registration.id;

--
-- Name: user_registration_seq; Type: SEQUENCE; Schema: public; Owner: web
--

CREATE SEQUENCE user_registration_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.user_registration_seq OWNER TO web;

--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: call2ride
--

CREATE SEQUENCE users_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE public.users_id_seq OWNER TO call2ride;

--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: call2ride
--

ALTER SEQUENCE users_id_seq OWNED BY users.id;

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: web
--

ALTER TABLE company ALTER COLUMN id SET DEFAULT nextval('companies_id_seq'::regclass);

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: web
--

ALTER TABLE error_log ALTER COLUMN id SET DEFAULT nextval('error_log_id_seq'::regclass);

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: web
--

ALTER TABLE location ALTER COLUMN id SET DEFAULT nextval('location_id_seq'::regclass);

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: web
--

ALTER TABLE pickuppoint ALTER COLUMN id SET DEFAULT nextval('pickuppoint_id_seq'::regclass);

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: call2ride
--

ALTER TABLE public_transport ALTER COLUMN id SET DEFAULT nextval('public_transport_id_seq'::regclass);

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: call2ride
--

ALTER TABLE ride_offers ALTER COLUMN id SET DEFAULT nextval('ride_offers_id_seq'::regclass);

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: call2ride
--

ALTER TABLE ride_requests ALTER COLUMN id SET DEFAULT nextval('ride_requests_id_seq'::regclass);

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: web
--

ALTER TABLE route_pickuppoint ALTER COLUMN id SET DEFAULT nextval('route_pickuppoint_id_seq'::regclass);

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: call2ride
--

ALTER TABLE sms ALTER COLUMN id SET DEFAULT nextval('sms_id_seq'::regclass);

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: call2ride
--

ALTER TABLE status_log ALTER COLUMN id SET DEFAULT nextval('status_log_id_seq'::regclass);

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: call2ride
--

ALTER TABLE taxi ALTER COLUMN id SET DEFAULT nextval('taxi_id_seq'::regclass);

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: web
--

ALTER TABLE user_number ALTER COLUMN id SET DEFAULT nextval('user_numbers_id_seq'::regclass);

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: web
--

ALTER TABLE user_registration ALTER COLUMN id SET DEFAULT nextval('user_registration_id_seq'::regclass);

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: call2ride
--

ALTER TABLE users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);

--
-- Name: companies_pkey; Type: CONSTRAINT; Schema: public; Owner: web; Tablespace:
--

ALTER TABLE ONLY company
ADD CONSTRAINT companies_pkey PRIMARY KEY (id);

--
-- Name: error_log_pkey; Type: CONSTRAINT; Schema: public; Owner: web; Tablespace:
--

ALTER TABLE ONLY error_log
ADD CONSTRAINT error_log_pkey PRIMARY KEY (id);

--
-- Name: location_pkey; Type: CONSTRAINT; Schema: public; Owner: web; Tablespace:
--

ALTER TABLE ONLY location
ADD CONSTRAINT location_pkey PRIMARY KEY (id);

--
-- Name: pickuppoint_pkey; Type: CONSTRAINT; Schema: public; Owner: web; Tablespace:
--

ALTER TABLE ONLY pickuppoint
ADD CONSTRAINT pickuppoint_pkey PRIMARY KEY (id);

--
-- Name: public_transport_pkey; Type: CONSTRAINT; Schema: public; Owner: call2ride; Tablespace:
--

ALTER TABLE ONLY public_transport
ADD CONSTRAINT public_transport_pkey PRIMARY KEY (id);

--
-- Name: ride_offers_pkey; Type: CONSTRAINT; Schema: public; Owner: call2ride; Tablespace:
--

ALTER TABLE ONLY ride_offers
ADD CONSTRAINT ride_offers_pkey PRIMARY KEY (id);

--
-- Name: ride_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: call2ride; Tablespace:
--

ALTER TABLE ONLY ride_requests
ADD CONSTRAINT ride_requests_pkey PRIMARY KEY (id);

--
-- Name: route_pickuppoint_pkey; Type: CONSTRAINT; Schema: public; Owner: web; Tablespace:
--

ALTER TABLE ONLY route_pickuppoint
ADD CONSTRAINT route_pickuppoint_pkey PRIMARY KEY (id);

--
-- Name: routes_pkey; Type: CONSTRAINT; Schema: public; Owner: call2ride; Tablespace:
--

ALTER TABLE ONLY routes
ADD CONSTRAINT routes_pkey PRIMARY KEY (id);

--
-- Name: sms_pkey; Type: CONSTRAINT; Schema: public; Owner: call2ride; Tablespace:
--

ALTER TABLE ONLY sms
ADD CONSTRAINT sms_pkey PRIMARY KEY (id);

--
-- Name: status_log_pkey; Type: CONSTRAINT; Schema: public; Owner: call2ride; Tablespace:
--

ALTER TABLE ONLY status_log
ADD CONSTRAINT status_log_pkey PRIMARY KEY (id);

--
-- Name: taxi_pkey; Type: CONSTRAINT; Schema: public; Owner: call2ride; Tablespace:
--

ALTER TABLE ONLY taxi
ADD CONSTRAINT taxi_pkey PRIMARY KEY (id);

--
-- Name: user_numbers_pkey; Type: CONSTRAINT; Schema: public; Owner: web; Tablespace:
--

ALTER TABLE ONLY user_number
ADD CONSTRAINT user_numbers_pkey PRIMARY KEY (id);

--
-- Name: user_registration_pkey; Type: CONSTRAINT; Schema: public; Owner: web; Tablespace:
--

ALTER TABLE ONLY user_registration
ADD CONSTRAINT user_registration_pkey PRIMARY KEY (id);

--
-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: call2ride; Tablespace:
--

ALTER TABLE ONLY users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);

--
-- Name: public_transport_route_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: call2ride
--

ALTER TABLE ONLY public_transport
ADD CONSTRAINT public_transport_route_id_fkey FOREIGN KEY (route_id) REFERENCES routes(id);

--
-- Name: ride_offers_route_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: call2ride
--

ALTER TABLE ONLY ride_offers
ADD CONSTRAINT ride_offers_route_id_fkey FOREIGN KEY (route_id) REFERENCES routes(id);

--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;

--
-- Name: routes_seq; Type: ACL; Schema: public; Owner: web
--

REVOKE ALL ON SEQUENCE routes_seq FROM PUBLIC;
REVOKE ALL ON SEQUENCE routes_seq FROM web;
GRANT ALL ON SEQUENCE routes_seq TO web;
GRANT ALL ON SEQUENCE routes_seq TO call2ride;

--
-- Name: company; Type: ACL; Schema: public; Owner: web
--

REVOKE ALL ON TABLE company FROM PUBLIC;
REVOKE ALL ON TABLE company FROM web;
GRANT ALL ON TABLE company TO web;
GRANT ALL ON TABLE company TO call2ride;
GRANT ALL ON TABLE company TO postgres;

--
-- Name: companies_id_seq; Type: ACL; Schema: public; Owner: web
--

REVOKE ALL ON SEQUENCE companies_id_seq FROM PUBLIC;
REVOKE ALL ON SEQUENCE companies_id_seq FROM web;
GRANT ALL ON SEQUENCE companies_id_seq TO web;
GRANT ALL ON SEQUENCE companies_id_seq TO call2ride;

--
-- Name: error_log; Type: ACL; Schema: public; Owner: web
--

REVOKE ALL ON TABLE error_log FROM PUBLIC;
REVOKE ALL ON TABLE error_log FROM web;
GRANT ALL ON TABLE error_log TO web;
GRANT ALL ON TABLE error_log TO call2ride;

--
-- Name: error_log_id_seq; Type: ACL; Schema: public; Owner: web
--

REVOKE ALL ON SEQUENCE error_log_id_seq FROM PUBLIC;
REVOKE ALL ON SEQUENCE error_log_id_seq FROM web;
GRANT ALL ON SEQUENCE error_log_id_seq TO web;
GRANT ALL ON SEQUENCE error_log_id_seq TO call2ride;

--
-- Name: location; Type: ACL; Schema: public; Owner: web
--

REVOKE ALL ON TABLE location FROM PUBLIC;
REVOKE ALL ON TABLE location FROM web;
GRANT ALL ON TABLE location TO web;
GRANT ALL ON TABLE location TO call2ride;

--
-- Name: location_id_seq; Type: ACL; Schema: public; Owner: web
--

REVOKE ALL ON SEQUENCE location_id_seq FROM PUBLIC;
REVOKE ALL ON SEQUENCE location_id_seq FROM web;
GRANT ALL ON SEQUENCE location_id_seq TO web;
GRANT ALL ON SEQUENCE location_id_seq TO call2ride;

--
-- Name: pickuppoint; Type: ACL; Schema: public; Owner: web
--

REVOKE ALL ON TABLE pickuppoint FROM PUBLIC;
REVOKE ALL ON TABLE pickuppoint FROM web;
GRANT ALL ON TABLE pickuppoint TO web;
GRANT ALL ON TABLE pickuppoint TO call2ride;

--
-- Name: pickuppoint_id_seq; Type: ACL; Schema: public; Owner: web
--

REVOKE ALL ON SEQUENCE pickuppoint_id_seq FROM PUBLIC;
REVOKE ALL ON SEQUENCE pickuppoint_id_seq FROM web;
GRANT ALL ON SEQUENCE pickuppoint_id_seq TO web;
GRANT ALL ON SEQUENCE pickuppoint_id_seq TO call2ride;

--
-- Name: route_pickuppoint; Type: ACL; Schema: public; Owner: web
--

REVOKE ALL ON TABLE route_pickuppoint FROM PUBLIC;
REVOKE ALL ON TABLE route_pickuppoint FROM web;
GRANT ALL ON TABLE route_pickuppoint TO web;
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE route_pickuppoint TO call2ride;

--
-- Name: route_pickuppoint_id_seq; Type: ACL; Schema: public; Owner: web
--

REVOKE ALL ON SEQUENCE route_pickuppoint_id_seq FROM PUBLIC;
REVOKE ALL ON SEQUENCE route_pickuppoint_id_seq FROM web;
GRANT ALL ON SEQUENCE route_pickuppoint_id_seq TO web;
GRANT SELECT,UPDATE ON SEQUENCE route_pickuppoint_id_seq TO call2ride;

--
-- Name: user_number; Type: ACL; Schema: public; Owner: web
--

REVOKE ALL ON TABLE user_number FROM PUBLIC;
REVOKE ALL ON TABLE user_number FROM web;
GRANT ALL ON TABLE user_number TO web;
GRANT ALL ON TABLE user_number TO call2ride;

--
-- Name: user_numbers_id_seq; Type: ACL; Schema: public; Owner: web
--

REVOKE ALL ON SEQUENCE user_numbers_id_seq FROM PUBLIC;
REVOKE ALL ON SEQUENCE user_numbers_id_seq FROM web;
GRANT ALL ON SEQUENCE user_numbers_id_seq TO web;
GRANT ALL ON SEQUENCE user_numbers_id_seq TO call2ride;

--
-- Name: users_id_seq; Type: ACL; Schema: public; Owner: call2ride
--

REVOKE ALL ON SEQUENCE users_id_seq FROM PUBLIC;
REVOKE ALL ON SEQUENCE users_id_seq FROM call2ride;
GRANT ALL ON SEQUENCE users_id_seq TO call2ride;
GRANT ALL ON SEQUENCE users_id_seq TO postgres;
GRANT ALL ON SEQUENCE users_id_seq TO web;

--
-- PostgreSQL database dump complete
--


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.