text:
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;

--
-- Name: researchable_development; Type: COMMENT; Schema: -; Owner: -
--

COMMENT ON DATABASE researchable_development IS '
';

--
-- 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: unaccent; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA public;

--
-- Name: EXTENSION unaccent; Type: COMMENT; Schema: -; Owner: -
--

COMMENT ON EXTENSION unaccent IS 'text search dictionary that removes accents';

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: active_admin_comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE active_admin_comments (
    id integer NOT NULL,
    resource_id integer NOT NULL,
    resource_type character varying(255) NOT NULL,
    author_id integer,
    author_type character varying(255),
    body text,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    namespace character varying(255)
);

--
-- Name: active_admin_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: active_admin_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE active_admin_comments_id_seq OWNED BY active_admin_comments.id;

--
-- Name: backers; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE backers (
    id integer NOT NULL,
    project_id integer NOT NULL,
    user_id integer NOT NULL,
    reward_id integer,
    value numeric NOT NULL,
    confirmed boolean DEFAULT false NOT NULL,
    confirmed_at timestamp without time zone,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    anonymous boolean DEFAULT false,
    key text,
    requested_refund boolean DEFAULT false,
    refunded boolean DEFAULT false,
    credits boolean DEFAULT false,
    notified_finish boolean DEFAULT false,
    payment_method text,
    payment_token text,
    payment_id character varying(255),
    payer_name text,
    payer_email text,
    payer_document text,
    address_street text,
    address_number text,
    address_complement text,
    address_neighbourhood text,
    address_zip_code text,
    address_city text,
    address_state text,
    address_phone_number text,
    payment_choice text,
    payment_service_fee numeric,
    CONSTRAINT backers_value_positive CHECK ((value >= (0)::numeric))
);

--
-- Name: backers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: backers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE backers_id_seq OWNED BY backers.id;

--
-- Name: categories; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE categories (
    id integer NOT NULL,
    name text NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    CONSTRAINT categories_name_not_blank CHECK ((length(btrim(name)) > 0))
);

--
-- Name: categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE categories_id_seq OWNED BY categories.id;

--
-- Name: comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE comments (
    id integer NOT NULL,
    title text,
    comment text NOT NULL,
    comment_html text,
    commentable_id integer NOT NULL,
    commentable_type character varying(255) NOT NULL,
    user_id integer NOT NULL,
    project_update boolean DEFAULT false,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    CONSTRAINT comments_comment_not_blank CHECK ((length(btrim(comment)) > 0))
);

--
-- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE comments_id_seq OWNED BY comments.id;

--
-- Name: configurations; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE configurations (
    id integer NOT NULL,
    name text NOT NULL,
    value text,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    CONSTRAINT configurations_name_not_blank CHECK ((length(btrim(name)) > 0))
);

--
-- Name: configurations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: configurations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE configurations_id_seq OWNED BY configurations.id;

--
-- Name: curated_pages; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE curated_pages (
    id integer NOT NULL,
    name character varying(255),
    description text,
    analytics_id character varying(255),
    logo character varying(255),
    video_url character varying(255),
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    permalink character varying(255),
    visible boolean DEFAULT false,
    site_url character varying(255)
);

--
-- Name: curated_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: curated_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE curated_pages_id_seq OWNED BY curated_pages.id;

--
-- Name: institutional_videos; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE institutional_videos (
    id integer NOT NULL,
    title character varying(255),
    description text,
    video_url character varying(255),
    visible boolean,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);

--
-- Name: institutional_videos_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: institutional_videos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE institutional_videos_id_seq OWNED BY institutional_videos.id;

--
-- Name: notification_types; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE notification_types (
    id integer NOT NULL,
    name text NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);

--
-- Name: notification_types_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: notification_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE notification_types_id_seq OWNED BY notification_types.id;

--
-- Name: notifications; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE notifications (
    id integer NOT NULL,
    user_id integer NOT NULL,
    project_id integer,
    text text NOT NULL,
    twitter_text text,
    facebook_text text,
    email_subject text,
    email_text text,
    dismissed boolean DEFAULT false NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    notification_type_id integer,
    backer_id integer
);

--
-- Name: notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE notifications_id_seq OWNED BY notifications.id;

--
-- Name: oauth_providers; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE oauth_providers (
    id integer NOT NULL,
    name text NOT NULL,
    key text NOT NULL,
    secret text NOT NULL,
    scope text,
    "order" integer,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    strategy text,
    path text,
    CONSTRAINT oauth_providers_key_not_blank CHECK ((length(btrim(key)) > 0)),
    CONSTRAINT oauth_providers_name_not_blank CHECK ((length(btrim(name)) > 0)),
    CONSTRAINT oauth_providers_secret_not_blank CHECK ((length(btrim(secret)) > 0))
);

--
-- Name: oauth_providers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: oauth_providers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE oauth_providers_id_seq OWNED BY oauth_providers.id;

--
-- Name: payment_logs; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE payment_logs (
    id integer NOT NULL,
    backer_id integer,
    status integer,
    amount double precision,
    payment_status integer,
    moip_id integer,
    payment_method integer,
    payment_type character varying(255),
    consumer_email character varying(255),
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);

--
-- Name: payment_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: payment_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE payment_logs_id_seq OWNED BY payment_logs.id;

--
-- Name: payment_notifications; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE payment_notifications (
    id integer NOT NULL,
    backer_id integer NOT NULL,
    extra_data text,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);

--
-- Name: payment_notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: payment_notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE payment_notifications_id_seq OWNED BY payment_notifications.id;

--
-- Name: project_totals; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW project_totals AS
    SELECT backers.project_id, sum(backers.value) AS pledged, count(*) AS total_backers FROM backers WHERE (backers.confirmed = true) GROUP BY backers.project_id;

--
-- Name: projects; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE projects (
    id integer NOT NULL,
    name text NOT NULL,
    user_id integer NOT NULL,
    category_id integer NOT NULL,
    goal numeric NOT NULL,
    expires_at timestamp without time zone NOT NULL,
    about text NOT NULL,
    headline text NOT NULL,
    video_url text,
    image_url text,
    short_url text,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    can_finish boolean DEFAULT false,
    finished boolean DEFAULT false,
    about_html text,
    visible boolean DEFAULT true,
    rejected boolean DEFAULT false,
    recommended boolean DEFAULT false,
    home_page_comment text,
    successful boolean DEFAULT false,
    permalink character varying(255),
    flickr_url text,
    flickr_image text,
    flickr_thumb text,
    flickr_square text,
    academic_email character varying(255),
    video_thumbnail text,
    CONSTRAINT projects_about_not_blank CHECK ((length(btrim(about)) > 0)),
    CONSTRAINT projects_headline_length_within CHECK (((length(headline) >= 1) AND (length(headline) <= 140))),
    CONSTRAINT projects_headline_not_blank CHECK ((length(btrim(headline)) > 0))
);

--
-- Name: projects_curated_pages; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE projects_curated_pages (
    id integer NOT NULL,
    project_id integer,
    curated_page_id integer,
    description text,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    description_html text
);

--
-- Name: projects_curated_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: projects_curated_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE projects_curated_pages_id_seq OWNED BY projects_curated_pages.id;

--
-- Name: projects_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: projects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE projects_id_seq OWNED BY projects.id;

--
-- Name: projects_managers; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE projects_managers (
    user_id integer,
    project_id integer
);

--
-- Name: rewards; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE rewards (
    id integer NOT NULL,
    project_id integer NOT NULL,
    minimum_value numeric NOT NULL,
    maximum_backers integer,
    description text NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    CONSTRAINT rewards_maximum_backers_positive CHECK ((maximum_backers >= 0)),
    CONSTRAINT rewards_minimum_value_positive CHECK ((minimum_value >= (0)::numeric))
);

--
-- Name: rewards_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: rewards_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE rewards_id_seq OWNED BY rewards.id;

--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE schema_migrations (
    version character varying(255) NOT NULL
);

--
-- Name: states; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE states (
    id integer NOT NULL,
    name character varying(255) NOT NULL,
    acronym character varying(255) NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    CONSTRAINT states_acronym_not_blank CHECK ((length(btrim((acronym)::text)) > 0)),
    CONSTRAINT states_name_not_blank CHECK ((length(btrim((name)::text)) > 0))
);

--
-- Name: states_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: states_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE states_id_seq OWNED BY states.id;

--
-- Name: static_contents; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE static_contents (
    id integer NOT NULL,
    title character varying(255),
    body text,
    body_html text,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);

--
-- Name: static_contents_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: static_contents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE static_contents_id_seq OWNED BY static_contents.id;

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

CREATE TABLE users (
    id integer NOT NULL,
    primary_user_id integer,
    provider text NOT NULL,
    uid text NOT NULL,
    email text,
    name text,
    nickname text,
    bio text,
    image_url text,
    newsletter boolean DEFAULT false,
    project_updates boolean DEFAULT false,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    admin boolean DEFAULT false,
    full_name text,
    address_street text,
    address_number text,
    address_complement text,
    address_neighbourhood text,
    address_city text,
    address_state text,
    address_zip_code text,
    phone_number text,
    credits numeric DEFAULT 0,
    locale text DEFAULT 'pt'::text NOT NULL,
    cpf text,
    encrypted_password character varying(128) DEFAULT ''::character varying NOT NULL,
    reset_password_token character varying(255),
    reset_password_sent_at timestamp without time zone,
    remember_created_at timestamp without time zone,
    sign_in_count integer DEFAULT 0,
    current_sign_in_at timestamp without time zone,
    last_sign_in_at timestamp without time zone,
    current_sign_in_ip character varying(255),
    last_sign_in_ip character varying(255),
    twitter character varying(255),
    facebook_link character varying(255),
    other_link character varying(255),
    uploaded_image text,
    CONSTRAINT users_bio_length_within CHECK (((length(bio) >= 0) AND (length(bio) <= 140))),
    CONSTRAINT users_provider_not_blank CHECK ((length(btrim(provider)) > 0)),
    CONSTRAINT users_uid_not_blank CHECK ((length(btrim(uid)) > 0))
);

--
-- Name: statistics; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW statistics AS
    SELECT (SELECT count(*) AS count FROM users WHERE (users.primary_user_id IS NULL)) AS total_users, backers_totals.total_backs, backers_totals.total_backers, backers_totals.total_backed, projects_totals.total_projects, projects_totals.total_projects_success, projects_totals.total_projects_online FROM (SELECT count(*) AS total_backs, count(DISTINCT backers.user_id) AS total_backers, sum(backers.value) AS total_backed FROM backers WHERE backers.confirmed) backers_totals, (SELECT count(*) AS total_projects, count(CASE WHEN projects.successful THEN 1 ELSE NULL::integer END) AS total_projects_success, count(CASE WHEN ((projects.finished = false) AND (projects.expires_at >= now())) THEN 1 ELSE NULL::integer END) AS total_projects_online FROM projects WHERE projects.visible) projects_totals;

--
-- Name: updates; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE updates (
    id integer NOT NULL,
    user_id integer NOT NULL,
    project_id integer NOT NULL,
    title text,
    comment text NOT NULL,
    comment_html text NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);

--
-- Name: updates_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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

--
-- Name: updates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE updates_id_seq OWNED BY updates.id;

--
-- Name: user_totals; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW user_totals AS
    SELECT b.user_id AS id, b.user_id, sum(b.value) AS sum, count(*) AS count, sum(CASE WHEN (((NOT p.finished) OR p.successful) AND (NOT b.credits)) THEN (0)::numeric WHEN ((p.finished AND (NOT p.successful)) AND ((b.requested_refund AND (NOT b.credits)) OR (b.credits AND (NOT b.requested_refund)))) THEN (0)::numeric WHEN (((p.finished AND (NOT p.successful)) AND (NOT b.credits)) AND (NOT b.requested_refund)) THEN b.value ELSE (b.value * ((-1))::numeric) END) AS credits FROM (backers b JOIN projects p ON ((b.project_id = p.id))) WHERE (b.confirmed = true) GROUP BY b.user_id;

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

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

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

ALTER SEQUENCE users_id_seq OWNED BY users.id;

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

ALTER TABLE ONLY active_admin_comments ALTER COLUMN id SET DEFAULT nextval('active_admin_comments_id_seq'::regclass);

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

ALTER TABLE ONLY backers ALTER COLUMN id SET DEFAULT nextval('backers_id_seq'::regclass);

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

ALTER TABLE ONLY categories ALTER COLUMN id SET DEFAULT nextval('categories_id_seq'::regclass);

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

ALTER TABLE ONLY comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass);

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

ALTER TABLE ONLY configurations ALTER COLUMN id SET DEFAULT nextval('configurations_id_seq'::regclass);

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

ALTER TABLE ONLY curated_pages ALTER COLUMN id SET DEFAULT nextval('curated_pages_id_seq'::regclass);

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

ALTER TABLE ONLY institutional_videos ALTER COLUMN id SET DEFAULT nextval('institutional_videos_id_seq'::regclass);

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

ALTER TABLE ONLY notification_types ALTER COLUMN id SET DEFAULT nextval('notification_types_id_seq'::regclass);

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

ALTER TABLE ONLY notifications ALTER COLUMN id SET DEFAULT nextval('notifications_id_seq'::regclass);

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

ALTER TABLE ONLY oauth_providers ALTER COLUMN id SET DEFAULT nextval('oauth_providers_id_seq'::regclass);

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

ALTER TABLE ONLY payment_logs ALTER COLUMN id SET DEFAULT nextval('payment_logs_id_seq'::regclass);

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

ALTER TABLE ONLY payment_notifications ALTER COLUMN id SET DEFAULT nextval('payment_notifications_id_seq'::regclass);

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

ALTER TABLE ONLY projects ALTER COLUMN id SET DEFAULT nextval('projects_id_seq'::regclass);

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

ALTER TABLE ONLY projects_curated_pages ALTER COLUMN id SET DEFAULT nextval('projects_curated_pages_id_seq'::regclass);

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

ALTER TABLE ONLY rewards ALTER COLUMN id SET DEFAULT nextval('rewards_id_seq'::regclass);

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

ALTER TABLE ONLY states ALTER COLUMN id SET DEFAULT nextval('states_id_seq'::regclass);

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

ALTER TABLE ONLY static_contents ALTER COLUMN id SET DEFAULT nextval('static_contents_id_seq'::regclass);

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

ALTER TABLE ONLY updates ALTER COLUMN id SET DEFAULT nextval('updates_id_seq'::regclass);

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

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

--
-- Name: admin_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY active_admin_comments
    ADD CONSTRAINT admin_notes_pkey PRIMARY KEY (id);

--
-- Name: advert_videos_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY institutional_videos
    ADD CONSTRAINT advert_videos_pkey PRIMARY KEY (id);

--
-- Name: backers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY backers
    ADD CONSTRAINT backers_pkey PRIMARY KEY (id);

--
-- Name: categories_name_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY categories
    ADD CONSTRAINT categories_name_unique UNIQUE (name);

--
-- Name: categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY categories
    ADD CONSTRAINT categories_pkey PRIMARY KEY (id);

--
-- Name: comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY comments
    ADD CONSTRAINT comments_pkey PRIMARY KEY (id);

--
-- Name: configurations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY configurations
    ADD CONSTRAINT configurations_pkey PRIMARY KEY (id);

--
-- Name: curated_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY curated_pages
    ADD CONSTRAINT curated_pages_pkey PRIMARY KEY (id);

--
-- Name: notification_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY notification_types
    ADD CONSTRAINT notification_types_pkey PRIMARY KEY (id);

--
-- Name: notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY notifications
    ADD CONSTRAINT notifications_pkey PRIMARY KEY (id);

--
-- Name: oauth_providers_name_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY oauth_providers
    ADD CONSTRAINT oauth_providers_name_unique UNIQUE (name);

--
-- Name: oauth_providers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY oauth_providers
    ADD CONSTRAINT oauth_providers_pkey PRIMARY KEY (id);

--
-- Name: payment_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY payment_logs
    ADD CONSTRAINT payment_logs_pkey PRIMARY KEY (id);

--
-- Name: payment_notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY payment_notifications
    ADD CONSTRAINT payment_notifications_pkey PRIMARY KEY (id);

--
-- Name: projects_curated_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY projects_curated_pages
    ADD CONSTRAINT projects_curated_pages_pkey PRIMARY KEY (id);

--
-- Name: projects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY projects
    ADD CONSTRAINT projects_pkey PRIMARY KEY (id);

--
-- Name: rewards_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY rewards
    ADD CONSTRAINT rewards_pkey PRIMARY KEY (id);

--
-- Name: states_acronym_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY states
    ADD CONSTRAINT states_acronym_unique UNIQUE (acronym);

--
-- Name: states_name_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY states
    ADD CONSTRAINT states_name_unique UNIQUE (name);

--
-- Name: states_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY states
    ADD CONSTRAINT states_pkey PRIMARY KEY (id);

--
-- Name: static_contents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY static_contents
    ADD CONSTRAINT static_contents_pkey PRIMARY KEY (id);

--
-- Name: updates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY updates
    ADD CONSTRAINT updates_pkey PRIMARY KEY (id);

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

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

--
-- Name: users_provider_uid_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY users
    ADD CONSTRAINT users_provider_uid_unique UNIQUE (provider, uid);

--
-- Name: index_active_admin_comments_on_author_type_and_author_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_active_admin_comments_on_author_type_and_author_id ON active_admin_comments USING btree (author_type, author_id);

--
-- Name: index_active_admin_comments_on_namespace; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_active_admin_comments_on_namespace ON active_admin_comments USING btree (namespace);

--
-- Name: index_backers_on_confirmed; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_backers_on_confirmed ON backers USING btree (confirmed);

--
-- Name: index_backers_on_key; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_backers_on_key ON backers USING btree (key);

--
-- Name: index_backers_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_backers_on_project_id ON backers USING btree (project_id);

--
-- Name: index_backers_on_reward_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_backers_on_reward_id ON backers USING btree (reward_id);

--
-- Name: index_backers_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_backers_on_user_id ON backers USING btree (user_id);

--
-- Name: index_categories_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_categories_on_name ON categories USING btree (name);

--
-- Name: index_comments_on_commentable_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_comments_on_commentable_id ON comments USING btree (commentable_id);

--
-- Name: index_comments_on_commentable_type; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_comments_on_commentable_type ON comments USING btree (commentable_type);

--
-- Name: index_comments_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_comments_on_user_id ON comments USING btree (user_id);

--
-- Name: index_confirmed_backers_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_confirmed_backers_on_project_id ON backers USING btree (project_id) WHERE confirmed;

--
-- Name: index_curated_pages_on_permalink; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_curated_pages_on_permalink ON curated_pages USING btree (permalink);

--
-- Name: index_notification_types_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE UNIQUE INDEX index_notification_types_on_name ON notification_types USING btree (name);

--
-- Name: index_projects_on_category_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_projects_on_category_id ON projects USING btree (category_id);

--
-- Name: index_projects_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_projects_on_name ON projects USING btree (name);

--
-- Name: index_projects_on_permalink; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE UNIQUE INDEX index_projects_on_permalink ON projects USING btree (permalink);

--
-- Name: index_projects_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_projects_on_user_id ON projects USING btree (user_id);

--
-- Name: index_rewards_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_rewards_on_project_id ON rewards USING btree (project_id);

--
-- Name: index_users_on_email; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_users_on_email ON users USING btree (email);

--
-- Name: index_users_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_users_on_name ON users USING btree (name);

--
-- Name: index_users_on_reset_password_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE UNIQUE INDEX index_users_on_reset_password_token ON users USING btree (reset_password_token);

--
-- Name: index_users_on_uid; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX index_users_on_uid ON users USING btree (uid);

--
-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);

--
-- Name: users_email; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE UNIQUE INDEX users_email ON users USING btree (email) WHERE (provider = 'devise'::text);

--
-- Name: backers_project_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY backers
    ADD CONSTRAINT backers_project_id_reference FOREIGN KEY (project_id) REFERENCES projects(id);

--
-- Name: backers_reward_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY backers
    ADD CONSTRAINT backers_reward_id_reference FOREIGN KEY (reward_id) REFERENCES rewards(id);

--
-- Name: backers_user_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY backers
    ADD CONSTRAINT backers_user_id_reference FOREIGN KEY (user_id) REFERENCES users(id);

--
-- Name: comments_user_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY comments
    ADD CONSTRAINT comments_user_id_reference FOREIGN KEY (user_id) REFERENCES users(id);

--
-- Name: notifications_backer_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY notifications
    ADD CONSTRAINT notifications_backer_id_fk FOREIGN KEY (backer_id) REFERENCES backers(id);

--
-- Name: notifications_notification_type_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY notifications
    ADD CONSTRAINT notifications_notification_type_id_fk FOREIGN KEY (notification_type_id) REFERENCES notification_types(id);

--
-- Name: notifications_project_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY notifications
    ADD CONSTRAINT notifications_project_id_reference FOREIGN KEY (project_id) REFERENCES projects(id);

--
-- Name: notifications_user_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY notifications
    ADD CONSTRAINT notifications_user_id_reference FOREIGN KEY (user_id) REFERENCES users(id);

--
-- Name: payment_notifications_backer_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY payment_notifications
    ADD CONSTRAINT payment_notifications_backer_id_fk FOREIGN KEY (backer_id) REFERENCES backers(id);

--
-- Name: projects_category_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY projects
    ADD CONSTRAINT projects_category_id_reference FOREIGN KEY (category_id) REFERENCES categories(id);

--
-- Name: projects_user_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY projects
    ADD CONSTRAINT projects_user_id_reference FOREIGN KEY (user_id) REFERENCES users(id);

--
-- Name: rewards_project_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY rewards
    ADD CONSTRAINT rewards_project_id_reference FOREIGN KEY (project_id) REFERENCES projects(id);

--
-- Name: updates_project_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY updates
    ADD CONSTRAINT updates_project_id_fk FOREIGN KEY (project_id) REFERENCES projects(id);

--
-- Name: updates_user_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY updates
    ADD CONSTRAINT updates_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);

--
-- Name: users_primary_user_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY users
    ADD CONSTRAINT users_primary_user_id_reference FOREIGN KEY (primary_user_id) REFERENCES users(id);

--
-- PostgreSQL database dump complete
--

INSERT INTO schema_migrations (version) VALUES ('20101111125716');

INSERT INTO schema_migrations (version) VALUES ('20101111142800');

INSERT INTO schema_migrations (version) VALUES ('20101111144048');

INSERT INTO schema_migrations (version) VALUES ('20101111165728');

INSERT INTO schema_migrations (version) VALUES ('20101111194251');

INSERT INTO schema_migrations (version) VALUES ('20101227195636');

INSERT INTO schema_migrations (version) VALUES ('20110115042320');

INSERT INTO schema_migrations (version) VALUES ('20110116144756');

INSERT INTO schema_migrations (version) VALUES ('20110116145252');

INSERT INTO schema_migrations (version) VALUES ('20110205141425');

INSERT INTO schema_migrations (version) VALUES ('20110206165033');

INSERT INTO schema_migrations (version) VALUES ('20110224215609');

INSERT INTO schema_migrations (version) VALUES ('20110225055108');

INSERT INTO schema_migrations (version) VALUES ('20110225055853');

INSERT INTO schema_migrations (version) VALUES ('20110228152012');

INSERT INTO schema_migrations (version) VALUES ('20110306045315');

INSERT INTO schema_migrations (version) VALUES ('20110308180446');

INSERT INTO schema_migrations (version) VALUES ('20110311091509');

INSERT INTO schema_migrations (version) VALUES ('20110324025809');

INSERT INTO schema_migrations (version) VALUES ('20110324050959');

INSERT INTO schema_migrations (version) VALUES ('20110324051834');

INSERT INTO schema_migrations (version) VALUES ('20110324221518');

INSERT INTO schema_migrations (version) VALUES ('20110325045819');

INSERT INTO schema_migrations (version) VALUES ('20110325193222');

INSERT INTO schema_migrations (version) VALUES ('20110329062720');

INSERT INTO schema_migrations (version) VALUES ('20110330044639');

INSERT INTO schema_migrations (version) VALUES ('20110413230023');

INSERT INTO schema_migrations (version) VALUES ('20110414023602');

INSERT INTO schema_migrations (version) VALUES ('20110414025033');

INSERT INTO schema_migrations (version) VALUES ('20110414044247');

INSERT INTO schema_migrations (version) VALUES ('20110414045122');

INSERT INTO schema_migrations (version) VALUES ('20110418041238');

INSERT INTO schema_migrations (version) VALUES ('20110418042647');

INSERT INTO schema_migrations (version) VALUES ('20110420021459');

INSERT INTO schema_migrations (version) VALUES ('20110424054103');

INSERT INTO schema_migrations (version) VALUES ('20110425060617');

INSERT INTO schema_migrations (version) VALUES ('20110529183254');

INSERT INTO schema_migrations (version) VALUES ('20110529215147');

INSERT INTO schema_migrations (version) VALUES ('20110901233209');

INSERT INTO schema_migrations (version) VALUES ('20110902041446');

INSERT INTO schema_migrations (version) VALUES ('20110907205515');

INSERT INTO schema_migrations (version) VALUES ('20110909204440');

INSERT INTO schema_migrations (version) VALUES ('20110913153018');

INSERT INTO schema_migrations (version) VALUES ('20110913181431');

INSERT INTO schema_migrations (version) VALUES ('20110913182457');

INSERT INTO schema_migrations (version) VALUES ('20110914143043');

INSERT INTO schema_migrations (version) VALUES ('20110921184628');

INSERT INTO schema_migrations (version) VALUES ('20110926171926');

INSERT INTO schema_migrations (version) VALUES ('20110928201051');

INSERT INTO schema_migrations (version) VALUES ('20110929005257');

INSERT INTO schema_migrations (version) VALUES ('20110930125532');

INSERT INTO schema_migrations (version) VALUES ('20111031054952');

INSERT INTO schema_migrations (version) VALUES ('20111204155849');

INSERT INTO schema_migrations (version) VALUES ('20111206200756');

INSERT INTO schema_migrations (version) VALUES ('20111222131520');

INSERT INTO schema_migrations (version) VALUES ('20120103180021');

INSERT INTO schema_migrations (version) VALUES ('20120106120123');

INSERT INTO schema_migrations (version) VALUES ('20120107012927');

INSERT INTO schema_migrations (version) VALUES ('20120117170754');

INSERT INTO schema_migrations (version) VALUES ('20120124182251');

INSERT INTO schema_migrations (version) VALUES ('20120130180611');

INSERT INTO schema_migrations (version) VALUES ('20120130180612');

INSERT INTO schema_migrations (version) VALUES ('20120208033933');

INSERT INTO schema_migrations (version) VALUES ('20120210025623');

INSERT INTO schema_migrations (version) VALUES ('20120320131705');

INSERT INTO schema_migrations (version) VALUES ('20120424151825');

INSERT INTO schema_migrations (version) VALUES ('20120424152539');

INSERT INTO schema_migrations (version) VALUES ('20120425121355');

INSERT INTO schema_migrations (version) VALUES ('20120605023025');

INSERT INTO schema_migrations (version) VALUES ('20120621152909');

INSERT INTO schema_migrations (version) VALUES ('20120706141258');

INSERT INTO schema_migrations (version) VALUES ('20120711184251');

INSERT INTO schema_migrations (version) VALUES ('20120714183447');

INSERT INTO schema_migrations (version) VALUES ('20120719165413');

INSERT INTO schema_migrations (version) VALUES ('20120719193634');

INSERT INTO schema_migrations (version) VALUES ('20120731134318');

INSERT INTO schema_migrations (version) VALUES ('20120731140116');

INSERT INTO schema_migrations (version) VALUES ('20120808123236');

INSERT INTO schema_migrations (version) VALUES ('20120816161341');

INSERT INTO schema_migrations (version) VALUES ('20120828142018');

INSERT INTO schema_migrations (version) VALUES ('20120828194453');

INSERT INTO schema_migrations (version) VALUES ('20120830165535');

INSERT INTO schema_migrations (version) VALUES ('20120830165611');

INSERT INTO schema_migrations (version) VALUES ('20120830193053');

INSERT INTO schema_migrations (version) VALUES ('20120830204420');

INSERT INTO schema_migrations (version) VALUES ('20120903175855');

INSERT INTO schema_migrations (version) VALUES ('20120903185031');

INSERT INTO schema_migrations (version) VALUES ('20120905184600');

INSERT INTO schema_migrations (version) VALUES ('20120921162430');

INSERT INTO schema_migrations (version) VALUES ('20120921162555');

INSERT INTO schema_migrations (version) VALUES ('20120921174308');

INSERT INTO schema_migrations (version) VALUES ('20120921202355');

INSERT INTO schema_migrations (version) VALUES ('20120924185751');

INSERT INTO schema_migrations (version) VALUES ('20120925112402');

INSERT INTO schema_migrations (version) VALUES ('20120926223511');

INSERT INTO schema_migrations (version) VALUES ('20120926223643');

INSERT INTO schema_migrations (version) VALUES ('20120927023918');

INSERT INTO schema_migrations (version) VALUES ('20120929123134');

INSERT INTO schema_migrations (version) VALUES ('20120929133832');

INSERT INTO schema_migrations (version) VALUES ('20120929145351');

INSERT INTO schema_migrations (version) VALUES ('20121001010621');

INSERT INTO schema_migrations (version) VALUES ('20121010191842');

INSERT INTO schema_migrations (version) VALUES ('20121025195705');

INSERT INTO schema_migrations (version) VALUES ('20121030141648');


text:
"""Test linked list.

Include pytest unit tests for your linked list class in a file called
    test_linked_list.py. Use Test Driven Development principles.
    For each method of your class, including the constructor.
    First implement a test that would verify that the method works.
    Run the tests to show that it fails, then implement the code needed
    to make it pass. Be thorough in your testing. Ensure that you cover failure
    modes and possible edge-cases. The tests you write are as much a part of
    this assignment as the linked list itself.
"""

import pytest
import random

POP_PUSH_TABLE = [
    [5, 3],
    [100, 2],
    [random.randint(50, 100), random.randint(0, 50)]
]

@pytest.fixture
def six_string_list():
    """List with ten nodes, one of which is the string 'six'."""
    from linked_list import LinkedList
    ll = LinkedList(1, 2, 3, 4, 5, "six", 7, 8, 9, 10)
    return ll

@pytest.fixture
def nine_list():
    """List with nine nodes."""
    from linked_list import LinkedList
    ll = LinkedList(1, 2, 3, 4, 5, 6, 7, 8, 9)
    return ll

@pytest.fixture
def ten_list():
    """List with nine nodes."""
    from linked_list import LinkedList
    ll = LinkedList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
    return ll

def test_new_node_is_empty():
    """A new list is empty."""
    from linked_list import Node
    new_node = Node()
    assert new_node.val is None
    assert new_node.next is None

def test_new_node_with_data_has_data():
    """A new list with data has data."""
    from linked_list import Node
    new_node = Node(5)
    assert new_node.val == 5

def test_new_node_with_next_has_next():
    """A new node with data and next has next and data."""
    from linked_list import Node
    node1 = Node(5)
    node2 = Node(4, node1)
    assert node2.next is node1

def test_new_list_has_no_head():
    """A new linked list is without a head."""
    from linked_list import LinkedList
    ll = LinkedList()
    assert ll.head is None

def test_head():
    """Test that the head is equal to the last param."""
    from linked_list import LinkedList
    ll = LinkedList(1, 2, 3, 4, 5)
    assert ll.head.val == 5

def test_tail():
    """Test that the tail is equal to the first param."""
    from linked_list import LinkedList
    ll = LinkedList(1, 2, 3, 4, 5)
    assert ll.tail.val == 1

def test_single_input():
    """Test that a single param is both head and tail."""
    from linked_list import LinkedList
    ll = LinkedList(1)
    assert ll.head == ll.tail

def test_push_head():
    """Test that push goes to head."""
    from linked_list import LinkedList
    ll = LinkedList(1, 2, 3, 4, 5, 6, 7)
    ll.push(8)
    assert ll.head.val == 8

def test_push_length(nine_list):
    """Test that push increases self.length."""
    nine_list.push(10)
    assert nine_list.length == 10

@pytest.mark.parametrize("times_pushed, times_popped", POP_PUSH_TABLE)
def test_pop(times_pushed, times_popped):
    """Test that pop decreases self.length."""
    from linked_list import LinkedList
    ll = LinkedList()
    for i in range(times_pushed):
        ll.push(random.randint(0, 10))
    for i in range(times_popped):
        ll.pop()
    assert ll.length == times_pushed - times_popped

def test_pop_head(ten_list):
    """Test that pop replaces head."""
    ten_list.pop()
    assert ten_list.head.val == 9

def test_pop_empty():
    """When I pop from empty list, raise IndexError."""
    from linked_list import LinkedList
    ll = LinkedList()
    with pytest.raises(IndexError):
            ll.pop()

def test_when_pop_from_list_return_head(nine_list):
    """When I pop from a list that has data, I return the head node."""
    nine_list.push(18)
    old_head = nine_list.head
    assert nine_list.pop() == old_head.val

def test_length(ten_list):
    """Test that length is correct througout methods."""
    ten_list.pop()
    ten_list.push(1)
    ten_list.push('string')
    ten_list.remove(1)
    stringlength = len(ten_list.display().split())
    assert ten_list.length == stringlength

def test_size():
    """Test that size method returns correct length."""
    from linked_list import LinkedList
    ll = LinkedList(1, 2, 3)
    size = ll.size()
    assert ll.length == size

def test_search_str(six_string_list):
    """Test for search success."""
    found = six_string_list.search("six").val
    assert found == "six"

def test_search_num(six_string_list):
    """Test for search success."""
    found = six_string_list.search(8).val
    assert found == 8

def test_list_with_single_item_search():
    """Test that a list with only one item returns correctly."""
    from linked_list import LinkedList
    ll = LinkedList(1)
    found = ll.search(1).val
    assert found == 1

def test_search_fail(six_string_list):
    """Test for search to successfully fail."""
    found = six_string_list.search("doo doo brown")
    assert found is None

def test_remove(six_string_list):
    """Test remove with search."""
    six_string_list.remove("six")
    found = six_string_list.search("six")
    assert found is None

def test_remove_item_not_in_list():
    """Test that attempts to delete an item that is not there returns None."""
    from linked_list import LinkedList
    ll = LinkedList(1, 2, 3)
    assert ll.remove(4) is None

def test_remove_head():
    """Test remove head works appropriately."""
    from linked_list import LinkedList
    ll = LinkedList(1, 2, 3)
    ll.remove(3)
    assert ll.head.val == 2

def test_display(six_string_list):
    """Test proper display."""
    displayed = six_string_list.display()
    assert displayed == "(10, 9, 8, 7, 'six', 5, 4, 3, 2, 1)"

def test_display_nothing():
    """Test display an empty list returns the correct message."""
    from linked_list import LinkedList
    ll = LinkedList()
    assert ll.display() == "Nothing in list."

def test_iter_input_makes_seperate_nodes():
    """Test that an iter input gets seperate nodes."""
    from linked_list import LinkedList
    ll = LinkedList([1, 2, 3], 4, 5)
    assert ll.display() == '(5, 4, 3, 2, 1)'

redpajama_set_name: RedPajamaGithub


text:
import os

from setuptools import setup

with open(os.path.join(os.path.dirname(__file__), "README.rst")) as readme:
    long_description = readme.read()

classifiers = [
    "Development Status :: 3 - Alpha",
    "License :: OSI Approved :: MIT License",
    "Operating System :: OS Independent",
    "Programming Language :: Python",
    "Programming Language :: Python :: 2.6",
    "Programming Language :: Python :: 2.7",
    "Programming Language :: Python :: 2",
    "Programming Language :: Python :: Implementation :: CPython",
    "Programming Language :: Python :: Implementation :: PyPy"
]

setup(
    name="tomsbestfriend",
    version="0.1.0",
    packages=(),
    py_modules=["tomsbestfriend"],
    install_requires=["parsley"],
    author="Julian Berman",
    author_email="Julian@GrayVines.com",
    classifiers=classifiers,
    description="",
    license="MIT",
    long_description=long_description,
    url="https://github.com/Julian/TomsBestFriend",
)


text:
var parent = require('../../stable/array/filter');

module.exports = parent;


text:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Lisong Sun | Gregor von Laszewski</title>
    <link>/author/lisong-sun/</link>
      <atom:link href="/author/lisong-sun/index.xml" rel="self" type="application/rss+xml" />
    <description>Lisong Sun</description>
    <generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><lastBuildDate>Sat, 01 Jul 2006 00:00:00 +0000</lastBuildDate>
    <image>
      <url>/images/icon_hufdd866d90d76849587aac6fbf27da1ac_464_512x512_fill_lanczos_center_3.png</url>
      <title>Lisong Sun</title>
      <link>/author/lisong-sun/</link>
    </image>

    <item>
      <title>Collaboratory for Multi-scale Chemical Science (CMCS): Project Final Report.</title>
      <link>/publication/las-2006-cmcs-report/</link>
      <pubDate>Sat, 01 Jul 2006 00:00:00 +0000</pubDate>
      <guid>/publication/las-2006-cmcs-report/</guid>
      <description></description>
    </item>

  </channel>
</rss>