Repository URL to install this package:
|
Version:
4.0.0.pre.3 ▾
|
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
--
-- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS pg_stat_statements WITH SCHEMA public;
--
-- Name: EXTENSION pg_stat_statements; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION pg_stat_statements IS 'track execution statistics of all SQL statements executed';
--
-- Name: postgis; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;
--
-- Name: EXTENSION postgis; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION postgis IS 'PostGIS geometry, geography, and raster spatial types and functions';
--
-- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
--
-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: core_assignments; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE core_assignments (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
event_id uuid,
instructor_id uuid,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: core_bookings; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE core_bookings (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
state character varying DEFAULT 'open'::character varying,
user_id uuid,
event_id uuid,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
stripe_charge_id character varying,
payment_type character varying
);
--
-- Name: core_events; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE core_events (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
name character varying,
description text,
start_time timestamp without time zone,
end_time timestamp without time zone,
price integer,
booking_url character varying,
room character varying,
availability character varying DEFAULT 'unknown'::character varying,
spaces integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
external_id character varying,
activity_types character varying[] DEFAULT '{}'::character varying[],
difficulty_rating character varying[] DEFAULT '{}'::character varying[],
kit_requirements character varying,
organisation_venue_id uuid
);
--
-- Name: core_organisation_venues; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE core_organisation_venues (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
organisation_id uuid,
venue_id uuid,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
activity_types character varying[] DEFAULT '{}'::character varying[],
promotion_id uuid,
trial_available boolean DEFAULT false,
min_price integer DEFAULT 0,
max_price integer DEFAULT 0,
avg_price integer DEFAULT 0
);
--
-- Name: core_organisations; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE core_organisations (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
name character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
owner_id uuid,
logo_url character varying,
email character varying,
phone character varying,
website character varying,
instagram_account_name character varying,
bank_sort_code character varying,
bank_account_number character varying,
description character varying
);
--
-- Name: core_venues; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE core_venues (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
name character varying,
address character varying,
phone character varying,
latitude numeric(9,6),
longitude numeric(9,6),
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
logo_url character varying,
exclusive boolean,
showers boolean,
towels boolean,
yoga_mat boolean,
cycling_shoes boolean,
trainers boolean,
half_day_cancellation boolean,
full_day_cancellation boolean,
lockers boolean
);
--
-- Name: core_event_search_views; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW core_event_search_views AS
SELECT core_events.id AS event_id,
core_events.name AS event_name,
core_events.description AS event_description,
core_events.start_time AS event_start_time,
core_events.end_time AS event_end_time,
core_events.price AS event_price,
core_events.booking_url AS event_booking_url,
core_events.room AS event_room,
core_events.availability AS event_availability,
core_events.spaces AS event_spaces,
core_events.external_id AS event_external_id,
core_events.kit_requirements AS event_kit_requirements,
core_events.activity_types AS event_activity_types,
core_events.difficulty_rating AS event_difficulty_rating,
core_events.created_at AS event_created_at,
core_events.updated_at AS event_updated_at,
core_organisations.id AS organisation_id,
core_organisations.name AS organisation_name,
core_organisations.description AS organisation_description,
core_organisations.phone AS organisation_phone,
core_organisations.logo_url AS organisation_logo_url,
core_organisations.instagram_account_name AS organisation_instagram_account_name,
core_organisations.created_at AS organisation_created_at,
core_organisations.updated_at AS organisation_updated_at,
core_venues.id AS venue_id,
core_venues.name AS venue_name,
core_venues.address AS venue_address,
core_venues.phone AS venue_phone,
core_venues.logo_url AS venue_logo_url,
core_venues.latitude AS venue_latitude,
core_venues.longitude AS venue_longitude,
core_venues.showers AS venue_showers,
core_venues.towels AS venue_towels,
core_venues.yoga_mat AS venue_yoga_mat,
core_venues.cycling_shoes AS venue_cycling_shoes,
core_venues.trainers AS venue_trainers,
core_venues.half_day_cancellation AS venue_half_day_cancellation,
core_venues.full_day_cancellation AS venue_full_day_cancellation,
core_venues.created_at AS venue_created_at,
core_venues.updated_at AS venue_updated_at
FROM core_events,
core_organisations,
core_venues,
core_organisation_venues
WHERE (((core_events.organisation_venue_id = core_organisation_venues.id) AND (core_organisations.id = core_organisation_venues.organisation_id)) AND (core_venues.id = core_organisation_venues.venue_id));
--
-- Name: core_instructors; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE core_instructors (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
name character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
external_id character varying,
photo_url character varying,
description character varying,
organisation_id uuid
);
--
-- Name: core_pass_purchases; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE core_pass_purchases (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
pass_id uuid,
user_id uuid,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
purchased_date date
);
--
-- Name: core_passes; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE core_passes (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
price integer,
organisation_id uuid,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
duration integer
);
--
-- Name: core_promotions; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE core_promotions (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
title character varying,
description character varying,
image_url character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
sort_order integer DEFAULT 1
);
--
-- Name: core_users; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE core_users (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
name character varying,
email character varying,
date_of_birth date,
staff boolean,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
encrypted_password character varying DEFAULT ''::character varying NOT NULL,
reset_password_token character varying,
reset_password_sent_at timestamp without time zone,
remember_created_at timestamp without time zone,
sign_in_count integer DEFAULT 0 NOT NULL,
current_sign_in_at timestamp without time zone,
last_sign_in_at timestamp without time zone,
current_sign_in_ip character varying,
last_sign_in_ip character varying,
failed_attempts integer DEFAULT 0 NOT NULL,
unlock_token character varying,
locked_at timestamp without time zone,
notes character varying,
medical_issues character varying,
stripe_customer_id character varying,
provider character varying,
uid character varying,
purchases_allowed boolean DEFAULT true
);
--
-- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE oauth_access_grants (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
resource_owner_id uuid NOT NULL,
application_id uuid NOT NULL,
token character varying NOT NULL,
expires_in integer NOT NULL,
redirect_uri text NOT NULL,
created_at timestamp without time zone NOT NULL,
revoked_at timestamp without time zone,
scopes character varying
);
--
-- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE oauth_access_tokens (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
resource_owner_id uuid,
application_id uuid,
token character varying NOT NULL,
refresh_token character varying,
expires_in integer,
revoked_at timestamp without time zone,
created_at timestamp without time zone NOT NULL,
scopes character varying
);
--
-- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE oauth_applications (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
name character varying NOT NULL,
uid character varying NOT NULL,
secret character varying NOT NULL,
redirect_uri text NOT NULL,
scopes character varying DEFAULT ''::character varying NOT NULL,
owner_id uuid,
owner_type character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE schema_migrations (
version character varying NOT NULL
);
--
-- Name: core_assignments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY core_assignments
ADD CONSTRAINT core_assignments_pkey PRIMARY KEY (id);
--
-- Name: core_bookings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY core_bookings
ADD CONSTRAINT core_bookings_pkey PRIMARY KEY (id);
--
-- Name: core_events_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY core_events
ADD CONSTRAINT core_events_pkey PRIMARY KEY (id);
--
-- Name: core_instructors_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY core_instructors
ADD CONSTRAINT core_instructors_pkey PRIMARY KEY (id);
--
-- Name: core_organisation_venues_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY core_organisation_venues
ADD CONSTRAINT core_organisation_venues_pkey PRIMARY KEY (id);
--
-- Name: core_organisations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY core_organisations
ADD CONSTRAINT core_organisations_pkey PRIMARY KEY (id);
--
-- Name: core_pass_purchases_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY core_pass_purchases
ADD CONSTRAINT core_pass_purchases_pkey PRIMARY KEY (id);
--
-- Name: core_passes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY core_passes
ADD CONSTRAINT core_passes_pkey PRIMARY KEY (id);
--
-- Name: core_promotions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY core_promotions
ADD CONSTRAINT core_promotions_pkey PRIMARY KEY (id);
--
-- Name: core_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY core_users
ADD CONSTRAINT core_users_pkey PRIMARY KEY (id);
--
-- Name: core_venues_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY core_venues
ADD CONSTRAINT core_venues_pkey PRIMARY KEY (id);
--
-- Name: oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY oauth_access_grants
ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
--
-- Name: oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY oauth_access_tokens
ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
--
-- Name: oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY oauth_applications
ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
--
-- Name: index_core_assignments_on_event_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_core_assignments_on_event_id ON core_assignments USING btree (event_id);
--
-- Name: index_core_assignments_on_instructor_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_core_assignments_on_instructor_id ON core_assignments USING btree (instructor_id);
--
-- Name: index_core_bookings_on_event_id_and_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_core_bookings_on_event_id_and_user_id ON core_bookings USING btree (event_id, user_id);
--
-- Name: index_core_events_on_activity_types; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_core_events_on_activity_types ON core_events USING gin (activity_types);
--
-- Name: index_core_organisation_venues_on_activity_types; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_core_organisation_venues_on_activity_types ON core_organisation_venues USING gin (activity_types);
--
-- Name: index_core_organisation_venues_on_organisation_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_core_organisation_venues_on_organisation_id ON core_organisation_venues USING btree (organisation_id);
--
-- Name: index_core_organisation_venues_on_venue_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_core_organisation_venues_on_venue_id ON core_organisation_venues USING btree (venue_id);
--
-- Name: index_core_users_on_email; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_core_users_on_email ON core_users USING btree (email);
--
-- Name: index_core_users_on_reset_password_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_core_users_on_reset_password_token ON core_users USING btree (reset_password_token);
--
-- Name: index_core_users_on_unlock_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_core_users_on_unlock_token ON core_users USING btree (unlock_token);
--
-- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON oauth_access_grants USING btree (token);
--
-- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON oauth_access_tokens USING btree (refresh_token);
--
-- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON oauth_access_tokens USING btree (resource_owner_id);
--
-- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON oauth_access_tokens USING btree (token);
--
-- Name: index_oauth_applications_on_owner_id_and_owner_type; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_oauth_applications_on_owner_id_and_owner_type ON oauth_applications USING btree (owner_id, owner_type);
--
-- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_oauth_applications_on_uid ON oauth_applications USING btree (uid);
--
-- Name: index_on_core_venues_location; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_on_core_venues_location ON core_venues USING gist (st_geographyfromtext((((('SRID=4326;POINT('::text || longitude) || ' '::text) || latitude) || ')'::text)));
--
-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
--
-- PostgreSQL database dump complete
--
SET search_path TO "$user",public;
INSERT INTO schema_migrations (version) VALUES ('20150127172635');
INSERT INTO schema_migrations (version) VALUES ('20150127175647');
INSERT INTO schema_migrations (version) VALUES ('20150128104522');
INSERT INTO schema_migrations (version) VALUES ('20150128111429');
INSERT INTO schema_migrations (version) VALUES ('20150128120820');
INSERT INTO schema_migrations (version) VALUES ('20150128121727');
INSERT INTO schema_migrations (version) VALUES ('20150128123428');
INSERT INTO schema_migrations (version) VALUES ('20150128125744');
INSERT INTO schema_migrations (version) VALUES ('20150128152705');
INSERT INTO schema_migrations (version) VALUES ('20150128160720');
INSERT INTO schema_migrations (version) VALUES ('20150203152914');
INSERT INTO schema_migrations (version) VALUES ('20150217104819');
INSERT INTO schema_migrations (version) VALUES ('20150217111930');
INSERT INTO schema_migrations (version) VALUES ('20150217115308');
INSERT INTO schema_migrations (version) VALUES ('20150217155510');
INSERT INTO schema_migrations (version) VALUES ('20150219163536');
INSERT INTO schema_migrations (version) VALUES ('20150222160353');
INSERT INTO schema_migrations (version) VALUES ('20150223002413');
INSERT INTO schema_migrations (version) VALUES ('20150225172517');
INSERT INTO schema_migrations (version) VALUES ('20150225191851');
INSERT INTO schema_migrations (version) VALUES ('20150305130324');
INSERT INTO schema_migrations (version) VALUES ('20150305164134');
INSERT INTO schema_migrations (version) VALUES ('20150306155806');
INSERT INTO schema_migrations (version) VALUES ('20150308144331');
INSERT INTO schema_migrations (version) VALUES ('20150308144529');
INSERT INTO schema_migrations (version) VALUES ('20150308144650');
INSERT INTO schema_migrations (version) VALUES ('20150313132306');
INSERT INTO schema_migrations (version) VALUES ('20150313151419');
INSERT INTO schema_migrations (version) VALUES ('20150313155051');
INSERT INTO schema_migrations (version) VALUES ('20150313165938');
INSERT INTO schema_migrations (version) VALUES ('20150313170302');
INSERT INTO schema_migrations (version) VALUES ('20150313174159');
INSERT INTO schema_migrations (version) VALUES ('20150313180411');
INSERT INTO schema_migrations (version) VALUES ('20150313180604');
INSERT INTO schema_migrations (version) VALUES ('20150313181931');
INSERT INTO schema_migrations (version) VALUES ('20150317120536');
INSERT INTO schema_migrations (version) VALUES ('20150317121348');
INSERT INTO schema_migrations (version) VALUES ('20150317142638');
INSERT INTO schema_migrations (version) VALUES ('20150322221053');
INSERT INTO schema_migrations (version) VALUES ('20150324114837');
INSERT INTO schema_migrations (version) VALUES ('20150401150813');
INSERT INTO schema_migrations (version) VALUES ('20150416164509');
INSERT INTO schema_migrations (version) VALUES ('20150422095713');
INSERT INTO schema_migrations (version) VALUES ('20150422101040');
INSERT INTO schema_migrations (version) VALUES ('20150519125657');
INSERT INTO schema_migrations (version) VALUES ('20150519125922');
INSERT INTO schema_migrations (version) VALUES ('20150520161637');
INSERT INTO schema_migrations (version) VALUES ('20150521155201');
INSERT INTO schema_migrations (version) VALUES ('20150603140101');
INSERT INTO schema_migrations (version) VALUES ('20150603151001');
INSERT INTO schema_migrations (version) VALUES ('20150616110028');
INSERT INTO schema_migrations (version) VALUES ('20150624125604');
INSERT INTO schema_migrations (version) VALUES ('20150627184358');