Advertisement
Guest User

Heroku error

a guest
Jan 26th, 2013
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 54.05 KB | None | 0 0
  1. Running `rake db:migrate` attached to terminal... up, run.8513
  2. DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
  3. DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
  4. Error while setting omniauth providers: #<ActiveRecord::StatementInvalid: PG::Error: ERROR: relation "oauth_providers" does not exist
  5. LINE 5: WHERE a.attrelid = '"oauth_providers"'::regclas...
  6. ^
  7. : SELECT a.attname, format_type(a.atttypid, a.atttypmod),
  8. pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
  9. FROM pg_attribute a LEFT JOIN pg_attrdef d
  10. ON a.attrelid = d.adrelid AND a.attnum = d.adnum
  11. WHERE a.attrelid = '"oauth_providers"'::regclass
  12. AND a.attnum > 0 AND NOT a.attisdropped
  13. ORDER BY a.attnum
  14. >
  15. == InitialSchema: migrating ==================================================
  16. -- execute("--\n-- PostgreSQL database dump\n--\n\nSET statement_timeout = 0;\nSET client_encoding = 'UTF8';\nSET standard_conforming_strings = on;\nSET check_function_bodies = false;\nSET client_min_messages = warning;\n\n--\n-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -\n--\n\nCREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;\n\n\n--\n-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -\n--\n\nCOMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';\n\n\n--\n-- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: -\n--\n\nCREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;\n\n\n--\n-- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: -\n--\n\nCOMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';\n\n\n--\n-- Name: unaccent; Type: EXTENSION; Schema: -; Owner: -\n--\n\nCREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA public;\n\n\n--\n-- Name: EXTENSION unaccent; Type: COMMENT; Schema: -; Owner: -\n--\n\nCOMMENT ON EXTENSION unaccent IS 'text search dictionary that removes accents';\n\n\nSET search_path = public, pg_catalog;\n\nSET default_tablespace = '';\n\nSET default_with_oids = false;\n\n--\n-- Name: active_admin_comments; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE active_admin_comments (\n id integer NOT NULL,\n resource_id integer NOT NULL,\n resource_type character varying(255) NOT NULL,\n author_id integer,\n author_type character varying(255),\n body text,\n created_at timestamp without time zone,\n updated_at timestamp without time zone,\n namespace character varying(255)\n);\n\n\n--\n-- Name: admin_notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE admin_notes_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: admin_notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE admin_notes_id_seq OWNED BY active_admin_comments.id;\n\n\n--\n-- Name: institutional_videos; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE institutional_videos (\n id integer NOT NULL,\n title character varying(255),\n description text,\n video_url character varying(255),\n visible boolean,\n created_at timestamp without time zone,\n updated_at timestamp without time zone\n);\n\n\n--\n-- Name: advert_videos_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE advert_videos_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: advert_videos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE advert_videos_id_seq OWNED BY institutional_videos.id;\n\n\n--\n-- Name: backers; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE backers (\n id integer NOT NULL,\n project_id integer NOT NULL,\n user_id integer NOT NULL,\n reward_id integer,\n value numeric NOT NULL,\n confirmed boolean DEFAULT false NOT NULL,\n confirmed_at timestamp without time zone,\n created_at timestamp without time zone,\n updated_at timestamp without time zone,\n anonymous boolean DEFAULT false,\n key text,\n requested_refund boolean DEFAULT false,\n refunded boolean DEFAULT false,\n credits boolean DEFAULT false,\n notified_finish boolean DEFAULT false,\n payment_method text,\n payment_token text,\n payment_id character varying(255),\n payer_name text,\n payer_email text,\n payer_document text,\n address_street text,\n address_number text,\n address_complement text,\n address_neighbourhood text,\n address_zip_code text,\n address_city text,\n address_state text,\n address_phone_number text,\n payment_choice text,\n payment_service_fee numeric,\n CONSTRAINT backers_value_positive CHECK ((value >= (0)::numeric))\n);\n\n\n--\n-- Name: categories; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE categories (\n id integer NOT NULL,\n name text NOT NULL,\n created_at timestamp without time zone,\n updated_at timestamp without time zone,\n CONSTRAINT categories_name_not_blank CHECK ((length(btrim(name)) > 0))\n);\n\n\n--\n-- Name: projects; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE projects (\n id integer NOT NULL,\n name text NOT NULL,\n user_id integer NOT NULL,\n category_id integer NOT NULL,\n goal numeric NOT NULL,\n expires_at timestamp without time zone NOT NULL,\n about text NOT NULL,\n headline text NOT NULL,\n video_url text NOT NULL,\n image_url text,\n short_url text,\n created_at timestamp without time zone,\n updated_at timestamp without time zone,\n can_finish boolean DEFAULT false,\n finished boolean DEFAULT false,\n about_html text,\n visible boolean DEFAULT false,\n rejected boolean DEFAULT false,\n recommended boolean DEFAULT false,\n home_page_comment text,\n successful boolean DEFAULT false,\n permalink character varying(255),\n video_thumbnail text,\n state character varying(255),\n online_days integer DEFAULT 0,\n CONSTRAINT projects_about_not_blank CHECK ((length(btrim(about)) > 0)),\n CONSTRAINT projects_headline_length_within CHECK (((length(headline) >= 1) AND (length(headline) <= 140))),\n CONSTRAINT projects_headline_not_blank CHECK ((length(btrim(headline)) > 0)),\n CONSTRAINT projects_video_url_not_blank CHECK ((length(btrim(video_url)) > 0))\n);\n\n\n--\n-- Name: backers_by_category; Type: VIEW; Schema: public; Owner: -\n--\n\nCREATE VIEW backers_by_category AS\n SELECT to_char(b.created_at, 'yyyy'::text) AS year, c.name AS category, sum(b.value) AS total_backed, count(DISTINCT b.user_id) AS total_backers FROM ((backers b JOIN projects p ON ((p.id = b.project_id))) JOIN categories c ON ((c.id = p.category_id))) WHERE b.confirmed GROUP BY to_char(b.created_at, 'yyyy'::text), c.name ORDER BY to_char(b.created_at, 'yyyy'::text), c.name;\n\n\n--\n-- Name: backers_by_payment_choice; Type: VIEW; Schema: public; Owner: -\n--\n\nCREATE VIEW backers_by_payment_choice AS\n SELECT to_char(backers.created_at, 'yyyy-mm'::text) AS month, backers.payment_method, backers.payment_choice, sum(backers.value) AS total_backed, (sum(backers.value) / bbm.total_month_backed) AS payment_choice_ratio, sum(CASE WHEN backers.refunded THEN backers.value ELSE NULL::numeric END) AS total_refunded, (sum(CASE WHEN backers.refunded THEN backers.value ELSE NULL::numeric END) / bbm.total_month_backed) AS refunded_ratio FROM (backers JOIN (SELECT to_char(b2.created_at, 'yyyy-mm'::text) AS b2month, sum(b2.value) AS total_month_backed FROM backers b2 WHERE b2.confirmed GROUP BY to_char(b2.created_at, 'yyyy-mm'::text)) bbm ON ((bbm.b2month = to_char(backers.created_at, 'yyyy-mm'::text)))) WHERE backers.confirmed GROUP BY to_char(backers.created_at, 'yyyy-mm'::text), bbm.total_month_backed, backers.payment_method, backers.payment_choice ORDER BY to_char(backers.created_at, 'yyyy-mm'::text), backers.payment_method, backers.payment_choice;\n\n\n--\n-- Name: backers_by_project; Type: VIEW; Schema: public; Owner: -\n--\n\nCREATE VIEW backers_by_project AS\n SELECT backers.project_id, sum(backers.value) AS total_backed, max(backers.value) AS max_backed, count(DISTINCT backers.user_id) AS total_backers FROM backers WHERE backers.confirmed GROUP BY backers.project_id;\n\n\n--\n-- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE users (\n id integer NOT NULL,\n primary_user_id integer,\n provider text NOT NULL,\n uid text NOT NULL,\n email text,\n name text,\n nickname text,\n bio text,\n image_url text,\n newsletter boolean DEFAULT false,\n project_updates boolean DEFAULT false,\n created_at timestamp without time zone,\n updated_at timestamp without time zone,\n admin boolean DEFAULT false,\n full_name text,\n address_street text,\n address_number text,\n address_complement text,\n address_neighbourhood text,\n address_city text,\n address_state text,\n address_zip_code text,\n phone_number text,\n credits numeric DEFAULT 0,\n locale text DEFAULT 'pt'::text NOT NULL,\n cpf text,\n encrypted_password character varying(128) DEFAULT ''::character varying NOT NULL,\n reset_password_token character varying(255),\n reset_password_sent_at timestamp without time zone,\n remember_created_at timestamp without time zone,\n sign_in_count integer DEFAULT 0,\n current_sign_in_at timestamp without time zone,\n last_sign_in_at timestamp without time zone,\n current_sign_in_ip character varying(255),\n last_sign_in_ip character varying(255),\n twitter character varying(255),\n facebook_link character varying(255),\n other_link character varying(255),\n uploaded_image text,\n CONSTRAINT users_bio_length_within CHECK (((length(bio) >= 0) AND (length(bio) <= 140))),\n CONSTRAINT users_provider_not_blank CHECK ((length(btrim(provider)) > 0)),\n CONSTRAINT users_uid_not_blank CHECK ((length(btrim(uid)) > 0))\n);\n\n\n--\n-- Name: backers_by_state; Type: VIEW; Schema: public; Owner: -\n--\n\nCREATE VIEW backers_by_state AS\n SELECT to_char(b.created_at, 'yyyy'::text) AS year, NULLIF(u.address_state, ''::text) AS state, sum(b.value) AS total_backed, count(DISTINCT b.user_id) AS total_backers FROM (backers b JOIN users u ON ((u.id = b.user_id))) WHERE b.confirmed GROUP BY to_char(b.created_at, 'yyyy'::text), NULLIF(u.address_state, ''::text) ORDER BY to_char(b.created_at, 'yyyy'::text), NULLIF(u.address_state, ''::text);\n\n\n--\n-- Name: backers_by_year; Type: VIEW; Schema: public; Owner: -\n--\n\nCREATE VIEW backers_by_year AS\n SELECT to_char(backers.created_at, 'yyyy'::text) AS year, sum(backers.value) AS total_backed, count(DISTINCT backers.user_id) AS total_backers, count(DISTINCT CASE WHEN (backers.reward_id IS NULL) THEN backers.user_id ELSE NULL::integer END) AS total_backers_without_reward, ((count(DISTINCT CASE WHEN (backers.reward_id IS NULL) THEN backers.user_id ELSE NULL::integer END))::numeric / (count(DISTINCT backers.user_id))::numeric) AS backers_without_reward_ratio, max(backers.value) AS maximum_back FROM backers WHERE backers.confirmed GROUP BY to_char(backers.created_at, 'yyyy'::text);\n\n\n--\n-- Name: backers_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE backers_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: backers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE backers_id_seq OWNED BY backers.id;\n\n\n--\n-- Name: categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE categories_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE categories_id_seq OWNED BY categories.id;\n\n\n--\n-- Name: comments; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE comments (\n id integer NOT NULL,\n title text,\n comment text NOT NULL,\n comment_html text,\n commentable_id integer NOT NULL,\n commentable_type character varying(255) NOT NULL,\n user_id integer NOT NULL,\n project_update boolean DEFAULT false,\n created_at timestamp without time zone,\n updated_at timestamp without time zone,\n CONSTRAINT comments_comment_not_blank CHECK ((length(btrim(comment)) > 0))\n);\n\n\n--\n-- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE comments_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE comments_id_seq OWNED BY comments.id;\n\n\n--\n-- Name: configurations; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE configurations (\n id integer NOT NULL,\n name text NOT NULL,\n value text,\n created_at timestamp without time zone,\n updated_at timestamp without time zone,\n CONSTRAINT configurations_name_not_blank CHECK ((length(btrim(name)) > 0))\n);\n\n\n--\n-- Name: configurations_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE configurations_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: configurations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE configurations_id_seq OWNED BY configurations.id;\n\n\n--\n-- Name: curated_pages; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE curated_pages (\n id integer NOT NULL,\n name character varying(255),\n description text,\n analytics_id character varying(255),\n logo character varying(255),\n video_url character varying(255),\n created_at timestamp without time zone,\n updated_at timestamp without time zone,\n permalink character varying(255),\n visible boolean DEFAULT false,\n site_url character varying(255)\n);\n\n\n--\n-- Name: curated_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE curated_pages_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: curated_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE curated_pages_id_seq OWNED BY curated_pages.id;\n\n\n--\n-- Name: notification_types; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE notification_types (\n id integer NOT NULL,\n name text NOT NULL,\n created_at timestamp without time zone NOT NULL,\n updated_at timestamp without time zone NOT NULL\n);\n\n\n--\n-- Name: notification_types_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE notification_types_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: notification_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE notification_types_id_seq OWNED BY notification_types.id;\n\n\n--\n-- Name: notifications; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE notifications (\n id integer NOT NULL,\n user_id integer NOT NULL,\n project_id integer,\n dismissed boolean DEFAULT false NOT NULL,\n created_at timestamp without time zone,\n updated_at timestamp without time zone,\n notification_type_id integer NOT NULL,\n backer_id integer,\n update_id integer\n);\n\n\n--\n-- Name: notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE notifications_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE notifications_id_seq OWNED BY notifications.id;\n\n\n--\n-- Name: oauth_providers; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE oauth_providers (\n id integer NOT NULL,\n name text NOT NULL,\n key text NOT NULL,\n secret text NOT NULL,\n scope text,\n \"order\" integer,\n created_at timestamp without time zone,\n updated_at timestamp without time zone,\n strategy text,\n path text,\n CONSTRAINT oauth_providers_key_not_blank CHECK ((length(btrim(key)) > 0)),\n CONSTRAINT oauth_providers_name_not_blank CHECK ((length(btrim(name)) > 0)),\n CONSTRAINT oauth_providers_secret_not_blank CHECK ((length(btrim(secret)) > 0))\n);\n\n\n--\n-- Name: oauth_providers_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE oauth_providers_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: oauth_providers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE oauth_providers_id_seq OWNED BY oauth_providers.id;\n\n\n--\n-- Name: payment_logs; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE payment_logs (\n id integer NOT NULL,\n backer_id integer,\n status integer,\n amount double precision,\n payment_status integer,\n moip_id integer,\n payment_method integer,\n payment_type character varying(255),\n consumer_email character varying(255),\n created_at timestamp without time zone,\n updated_at timestamp without time zone\n);\n\n\n--\n-- Name: payment_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE payment_logs_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: payment_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE payment_logs_id_seq OWNED BY payment_logs.id;\n\n\n--\n-- Name: payment_notifications; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE payment_notifications (\n id integer NOT NULL,\n backer_id integer NOT NULL,\n extra_data text,\n created_at timestamp without time zone NOT NULL,\n updated_at timestamp without time zone NOT NULL\n);\n\n\n--\n-- Name: payment_notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE payment_notifications_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: payment_notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE payment_notifications_id_seq OWNED BY payment_notifications.id;\n\n\n--\n-- Name: paypal_payments; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE paypal_payments (\n data text,\n hora text,\n fusohorario text,\n nome text,\n tipo text,\n status text,\n moeda text,\n valorbruto text,\n tarifa text,\n liquido text,\n doe_mail text,\n parae_mail text,\n iddatransacao text,\n statusdoequivalente text,\n statusdoendereco text,\n titulodoitem text,\n iddoitem text,\n valordoenvioemanuseio text,\n valordoseguro text,\n impostosobrevendas text,\n opcao1nome text,\n opcao1valor text,\n opcao2nome text,\n opcao2valor text,\n sitedoleilao text,\n iddocomprador text,\n urldoitem text,\n datadetermino text,\n iddaescritura text,\n iddafatura text,\n \"idtxn_dereferência\" text,\n numerodafatura text,\n numeropersonalizado text,\n iddorecibo text,\n saldo text,\n enderecolinha1 text,\n enderecolinha2_distrito_bairro text,\n cidade text,\n \"estado_regiao_território_prefeitura_republica\" text,\n cep text,\n pais text,\n numerodotelefoneparacontato text,\n extra text\n);\n\n\n--\n-- Name: paypal_pending; Type: VIEW; Schema: public; Owner: -\n--\n\nCREATE VIEW paypal_pending AS\n SELECT string_agg((b.id)::text, ','::text) AS string_agg FROM (backers b JOIN paypal_payments p ON ((lower(p.doe_mail) = b.payer_email))) WHERE ((((b.payment_method = 'PayPal'::text) AND (p.status = 'Concluído'::text)) AND (NOT b.confirmed)) AND (to_number(p.valorbruto, '9,99'::text) = b.value));\n\n\n--\n-- Name: project_totals; Type: VIEW; Schema: public; Owner: -\n--\n\nCREATE VIEW project_totals AS\n SELECT backers.project_id, sum(backers.value) AS pledged, count(*) AS total_backers FROM backers WHERE (backers.confirmed = true) GROUP BY backers.project_id;\n\n\n--\n-- Name: projects_by_category; Type: VIEW; Schema: public; Owner: -\n--\n\nCREATE VIEW projects_by_category AS\n SELECT to_char(p.created_at, 'yyyy'::text) AS year, c.name AS category, count(*) AS total_projects, count(NULLIF(p.successful, false)) AS successful_projects FROM (projects p JOIN categories c ON ((c.id = p.category_id))) WHERE p.finished GROUP BY to_char(p.created_at, 'yyyy'::text), c.name ORDER BY to_char(p.created_at, 'yyyy'::text), c.name;\n\n\n--\n-- Name: projects_by_state; Type: VIEW; Schema: public; Owner: -\n--\n\nCREATE VIEW projects_by_state AS\n SELECT to_char(p.created_at, 'yyyy'::text) AS year, NULLIF(btrim(u.address_state), ''::text) AS uf, count(*) AS total_projects, count(NULLIF(p.successful, false)) AS successful_projects FROM (projects p JOIN users u ON ((u.id = p.user_id))) WHERE p.finished GROUP BY to_char(p.created_at, 'yyyy'::text), NULLIF(btrim(u.address_state), ''::text) ORDER BY to_char(p.created_at, 'yyyy'::text), NULLIF(btrim(u.address_state), ''::text);\n\n\n--\n-- Name: total_backed_ranges; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE total_backed_ranges (\n name text NOT NULL,\n lower numeric,\n upper numeric\n);\n\n\n--\n-- Name: projects_by_total_backed_ranges; Type: VIEW; Schema: public; Owner: -\n--\n\nCREATE VIEW projects_by_total_backed_ranges AS\n SELECT tbr.lower, tbr.upper, count(*) AS count, ((count(*))::numeric / ((SELECT count(*) AS count FROM backers_by_project))::numeric) AS ratio FROM (backers_by_project bp JOIN total_backed_ranges tbr ON (((bp.total_backed >= tbr.lower) AND (bp.total_backed <= tbr.upper)))) GROUP BY tbr.lower, tbr.upper ORDER BY tbr.lower;\n\n\n--\n-- Name: projects_by_year; Type: VIEW; Schema: public; Owner: -\n--\n\nCREATE VIEW projects_by_year AS\n SELECT to_char(p.created_at, 'yyyy'::text) AS year, count(*) AS total_projects, count(NULLIF(p.successful, false)) AS successful_projects, sum(CASE WHEN p.successful THEN b.total_backed ELSE NULL::numeric END) AS successful_total_backed, max(b.total_backed) AS max_total_backed, max(b.max_backed) AS max_backed, max(b.total_backers) AS max_total_backers FROM (projects p LEFT JOIN backers_by_project b ON ((b.project_id = p.id))) WHERE p.finished GROUP BY to_char(p.created_at, 'yyyy'::text) ORDER BY to_char(p.created_at, 'yyyy'::text);\n\n\n--\n-- Name: projects_curated_pages; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE projects_curated_pages (\n id integer NOT NULL,\n project_id integer,\n curated_page_id integer,\n description text,\n created_at timestamp without time zone,\n updated_at timestamp without time zone,\n description_html text\n);\n\n\n--\n-- Name: projects_curated_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE projects_curated_pages_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: projects_curated_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE projects_curated_pages_id_seq OWNED BY projects_curated_pages.id;\n\n\n--\n-- Name: projects_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE projects_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: projects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE projects_id_seq OWNED BY projects.id;\n\n\n--\n-- Name: projects_managers; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE projects_managers (\n user_id integer,\n project_id integer\n);\n\n\n--\n-- Name: recurring_backers_by_year; Type: VIEW; Schema: public; Owner: -\n--\n\nCREATE VIEW recurring_backers_by_year AS\n SELECT bby.year, trb.total_recurring_backed, bby.total_backed, (trb.total_recurring_backed / bby.total_backed) AS recurring_backed_ratio, trb.total_recurring_backers, bby.total_backers, (trb.total_recurring_backers / (bby.total_backers)::numeric) AS recurring_backers_ratio FROM ((SELECT rb.year, sum(rb.total_recurring_backed) AS total_recurring_backed, sum(rb.total_recurring_backers) AS total_recurring_backers FROM (SELECT to_char(backers.created_at, 'yyyy'::text) AS year, sum(backers.value) AS total_recurring_backed, count(DISTINCT backers.user_id) AS total_recurring_backers FROM backers WHERE backers.confirmed GROUP BY to_char(backers.created_at, 'yyyy'::text), backers.user_id HAVING (count(*) > 1)) rb GROUP BY rb.year) trb JOIN backers_by_year bby USING (year));\n\n\n--\n-- Name: reward_ranges; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE reward_ranges (\n name text NOT NULL,\n lower numeric,\n upper numeric\n);\n\n\n--\n-- Name: rewards; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE rewards (\n id integer NOT NULL,\n project_id integer NOT NULL,\n minimum_value numeric NOT NULL,\n maximum_backers integer,\n description text NOT NULL,\n created_at timestamp without time zone,\n updated_at timestamp without time zone,\n CONSTRAINT rewards_maximum_backers_positive CHECK ((maximum_backers >= 0)),\n CONSTRAINT rewards_minimum_value_positive CHECK ((minimum_value >= (0)::numeric))\n);\n\n\n--\n-- Name: rewards_by_range; Type: VIEW; Schema: public; Owner: -\n--\n\nCREATE VIEW rewards_by_range AS\n SELECT rr.name AS range, count(*) AS count, ((count(*))::numeric / ((SELECT count(*) AS count FROM backers WHERE (backers.confirmed AND (backers.reward_id IS NOT NULL))))::numeric) AS ratio FROM ((reward_ranges rr JOIN rewards r ON (((r.minimum_value >= rr.lower) AND (r.minimum_value <= rr.upper)))) JOIN backers b ON ((b.reward_id = r.id))) WHERE b.confirmed GROUP BY rr.name, rr.lower ORDER BY rr.lower;\n\n\n--\n-- Name: rewards_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE rewards_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: rewards_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE rewards_id_seq OWNED BY rewards.id;\n\n--\n-- Name: states; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE states (\n id integer NOT NULL,\n name character varying(255) NOT NULL,\n acronym character varying(255) NOT NULL,\n created_at timestamp without time zone,\n updated_at timestamp without time zone,\n CONSTRAINT states_acronym_not_blank CHECK ((length(btrim((acronym)::text)) > 0)),\n CONSTRAINT states_name_not_blank CHECK ((length(btrim((name)::text)) > 0))\n);\n\n\n--\n-- Name: states_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE states_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: states_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE states_id_seq OWNED BY states.id;\n\n\n--\n-- Name: static_contents; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE static_contents (\n id integer NOT NULL,\n title character varying(255),\n body text,\n body_html text,\n created_at timestamp without time zone,\n updated_at timestamp without time zone\n);\n\n\n--\n-- Name: static_contents_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE static_contents_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: static_contents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE static_contents_id_seq OWNED BY static_contents.id;\n\n\n--\n-- Name: statistics; Type: VIEW; Schema: public; Owner: -\n--\n\nCREATE VIEW statistics AS\n 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;\n\n\n--\n-- Name: unsubscribes; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE unsubscribes (\n id integer NOT NULL,\n user_id integer NOT NULL,\n notification_type_id integer NOT NULL,\n project_id integer,\n created_at timestamp without time zone NOT NULL,\n updated_at timestamp without time zone NOT NULL\n);\n\n\n--\n-- Name: unsubscribes_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE unsubscribes_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: unsubscribes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE unsubscribes_id_seq OWNED BY unsubscribes.id;\n\n\n--\n-- Name: updates; Type: TABLE; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE TABLE updates (\n id integer NOT NULL,\n user_id integer NOT NULL,\n project_id integer NOT NULL,\n title text,\n comment text NOT NULL,\n comment_html text NOT NULL,\n created_at timestamp without time zone,\n updated_at timestamp without time zone\n);\n\n\n--\n-- Name: updates_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE updates_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: updates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE updates_id_seq OWNED BY updates.id;\n\n\n--\n-- Name: user_totals; Type: VIEW; Schema: public; Owner: -\n--\n\nCREATE VIEW user_totals AS\n 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;\n\n\n--\n-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -\n--\n\nCREATE SEQUENCE users_id_seq\n START WITH 1\n INCREMENT BY 1\n NO MINVALUE\n NO MAXVALUE\n CACHE 1;\n\n\n--\n-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -\n--\n\nALTER SEQUENCE users_id_seq OWNED BY users.id;\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY active_admin_comments ALTER COLUMN id SET DEFAULT nextval('admin_notes_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY backers ALTER COLUMN id SET DEFAULT nextval('backers_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY categories ALTER COLUMN id SET DEFAULT nextval('categories_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY configurations ALTER COLUMN id SET DEFAULT nextval('configurations_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY curated_pages ALTER COLUMN id SET DEFAULT nextval('curated_pages_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY institutional_videos ALTER COLUMN id SET DEFAULT nextval('advert_videos_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY notification_types ALTER COLUMN id SET DEFAULT nextval('notification_types_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY notifications ALTER COLUMN id SET DEFAULT nextval('notifications_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY oauth_providers ALTER COLUMN id SET DEFAULT nextval('oauth_providers_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY payment_logs ALTER COLUMN id SET DEFAULT nextval('payment_logs_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY payment_notifications ALTER COLUMN id SET DEFAULT nextval('payment_notifications_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY projects ALTER COLUMN id SET DEFAULT nextval('projects_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY projects_curated_pages ALTER COLUMN id SET DEFAULT nextval('projects_curated_pages_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY rewards ALTER COLUMN id SET DEFAULT nextval('rewards_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY states ALTER COLUMN id SET DEFAULT nextval('states_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY static_contents ALTER COLUMN id SET DEFAULT nextval('static_contents_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY unsubscribes ALTER COLUMN id SET DEFAULT nextval('unsubscribes_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY updates ALTER COLUMN id SET DEFAULT nextval('updates_id_seq'::regclass);\n\n\n--\n-- Name: id; Type: DEFAULT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);\n\n\n--\n-- Name: admin_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY active_admin_comments\n ADD CONSTRAINT admin_notes_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: advert_videos_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY institutional_videos\n ADD CONSTRAINT advert_videos_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: backers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY backers\n ADD CONSTRAINT backers_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: categories_name_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY categories\n ADD CONSTRAINT categories_name_unique UNIQUE (name);\n\n\n--\n-- Name: categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY categories\n ADD CONSTRAINT categories_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY comments\n ADD CONSTRAINT comments_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: configurations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY configurations\n ADD CONSTRAINT configurations_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: curated_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY curated_pages\n ADD CONSTRAINT curated_pages_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: notification_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY notification_types\n ADD CONSTRAINT notification_types_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY notifications\n ADD CONSTRAINT notifications_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: oauth_providers_name_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY oauth_providers\n ADD CONSTRAINT oauth_providers_name_unique UNIQUE (name);\n\n\n--\n-- Name: oauth_providers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY oauth_providers\n ADD CONSTRAINT oauth_providers_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: payment_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY payment_logs\n ADD CONSTRAINT payment_logs_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: payment_notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY payment_notifications\n ADD CONSTRAINT payment_notifications_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: projects_curated_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY projects_curated_pages\n ADD CONSTRAINT projects_curated_pages_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: projects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY projects\n ADD CONSTRAINT projects_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: reward_ranges_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY reward_ranges\n ADD CONSTRAINT reward_ranges_pkey PRIMARY KEY (name);\n\n\n--\n-- Name: rewards_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY rewards\n ADD CONSTRAINT rewards_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: states_acronym_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY states\n ADD CONSTRAINT states_acronym_unique UNIQUE (acronym);\n\n\n--\n-- Name: states_name_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY states\n ADD CONSTRAINT states_name_unique UNIQUE (name);\n\n\n--\n-- Name: states_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY states\n ADD CONSTRAINT states_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: static_contents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY static_contents\n ADD CONSTRAINT static_contents_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: total_backed_ranges_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY total_backed_ranges\n ADD CONSTRAINT total_backed_ranges_pkey PRIMARY KEY (name);\n\n\n--\n-- Name: unsubscribes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY unsubscribes\n ADD CONSTRAINT unsubscribes_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: updates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY updates\n ADD CONSTRAINT updates_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY users\n ADD CONSTRAINT users_pkey PRIMARY KEY (id);\n\n\n--\n-- Name: users_provider_uid_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: \n--\n\nALTER TABLE ONLY users\n ADD CONSTRAINT users_provider_uid_unique UNIQUE (provider, uid);\n\n\n--\n-- Name: index_active_admin_comments_on_author_type_and_author_id; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_active_admin_comments_on_author_type_and_author_id ON active_admin_comments USING btree (author_type, author_id);\n\n\n--\n-- Name: index_active_admin_comments_on_namespace; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_active_admin_comments_on_namespace ON active_admin_comments USING btree (namespace);\n\n\n--\n-- Name: index_backers_on_confirmed; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_backers_on_confirmed ON backers USING btree (confirmed);\n\n\n--\n-- Name: index_backers_on_key; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_backers_on_key ON backers USING btree (key);\n\n\n--\n-- Name: index_backers_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_backers_on_project_id ON backers USING btree (project_id);\n\n\n--\n-- Name: index_backers_on_reward_id; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_backers_on_reward_id ON backers USING btree (reward_id);\n\n\n--\n-- Name: index_backers_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_backers_on_user_id ON backers USING btree (user_id);\n\n\n--\n-- Name: index_categories_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_categories_on_name ON categories USING btree (name);\n\n\n--\n-- Name: index_comments_on_commentable_id; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_comments_on_commentable_id ON comments USING btree (commentable_id);\n\n\n--\n-- Name: index_comments_on_commentable_type; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_comments_on_commentable_type ON comments USING btree (commentable_type);\n\n\n--\n-- Name: index_comments_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_comments_on_user_id ON comments USING btree (user_id);\n\n\n--\n-- Name: index_confirmed_backers_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_confirmed_backers_on_project_id ON backers USING btree (project_id) WHERE confirmed;\n\n\n--\n-- Name: index_curated_pages_on_permalink; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_curated_pages_on_permalink ON curated_pages USING btree (permalink);\n\n\n--\n-- Name: index_notification_types_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE UNIQUE INDEX index_notification_types_on_name ON notification_types USING btree (name);\n\n\n--\n-- Name: index_notifications_on_update_id; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_notifications_on_update_id ON notifications USING btree (update_id);\n\n\n--\n-- Name: index_projects_on_category_id; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_projects_on_category_id ON projects USING btree (category_id);\n\n\n--\n-- Name: index_projects_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_projects_on_name ON projects USING btree (name);\n\n\n--\n-- Name: index_projects_on_permalink; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE UNIQUE INDEX index_projects_on_permalink ON projects USING btree (permalink);\n\n\n--\n-- Name: index_projects_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_projects_on_user_id ON projects USING btree (user_id);\n\n\n--\n-- Name: index_rewards_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_rewards_on_project_id ON rewards USING btree (project_id);\n\n\n--\n-- Name: index_unsubscribes_on_notification_type_id; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_unsubscribes_on_notification_type_id ON unsubscribes USING btree (notification_type_id);\n\n\n--\n-- Name: index_unsubscribes_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_unsubscribes_on_project_id ON unsubscribes USING btree (project_id);\n\n\n--\n-- Name: index_unsubscribes_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_unsubscribes_on_user_id ON unsubscribes USING btree (user_id);\n\n\n--\n-- Name: index_updates_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_updates_on_project_id ON updates USING btree (project_id);\n\n\n--\n-- Name: index_users_on_email; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_users_on_email ON users USING btree (email);\n\n\n--\n-- Name: index_users_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_users_on_name ON users USING btree (name);\n\n\n--\n-- Name: index_users_on_primary_user_id_and_provider; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_users_on_primary_user_id_and_provider ON users USING btree (primary_user_id, provider);\n\n\n--\n-- Name: index_users_on_reset_password_token; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE UNIQUE INDEX index_users_on_reset_password_token ON users USING btree (reset_password_token);\n\n\n--\n-- Name: index_users_on_uid; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE INDEX index_users_on_uid ON users USING btree (uid);\n\n\n--\n-- Name: users_email; Type: INDEX; Schema: public; Owner: -; Tablespace: \n--\n\nCREATE UNIQUE INDEX users_email ON users USING btree (email) WHERE (provider = 'devise'::text);\n\n\n--\n-- Name: backers_project_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY backers\n ADD CONSTRAINT backers_project_id_reference FOREIGN KEY (project_id) REFERENCES projects(id);\n\n\n--\n-- Name: backers_reward_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY backers\n ADD CONSTRAINT backers_reward_id_reference FOREIGN KEY (reward_id) REFERENCES rewards(id);\n\n\n--\n-- Name: backers_user_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY backers\n ADD CONSTRAINT backers_user_id_reference FOREIGN KEY (user_id) REFERENCES users(id);\n\n\n--\n-- Name: comments_user_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY comments\n ADD CONSTRAINT comments_user_id_reference FOREIGN KEY (user_id) REFERENCES users(id);\n\n\n--\n-- Name: notifications_backer_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY notifications\n ADD CONSTRAINT notifications_backer_id_fk FOREIGN KEY (backer_id) REFERENCES backers(id);\n\n\n--\n-- Name: notifications_notification_type_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY notifications\n ADD CONSTRAINT notifications_notification_type_id_fk FOREIGN KEY (notification_type_id) REFERENCES notification_types(id);\n\n\n--\n-- Name: notifications_project_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY notifications\n ADD CONSTRAINT notifications_project_id_reference FOREIGN KEY (project_id) REFERENCES projects(id);\n\n\n--\n-- Name: notifications_update_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY notifications\n ADD CONSTRAINT notifications_update_id_fk FOREIGN KEY (update_id) REFERENCES updates(id);\n\n\n--\n-- Name: notifications_user_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY notifications\n ADD CONSTRAINT notifications_user_id_reference FOREIGN KEY (user_id) REFERENCES users(id);\n\n\n--\n-- Name: payment_notifications_backer_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY payment_notifications\n ADD CONSTRAINT payment_notifications_backer_id_fk FOREIGN KEY (backer_id) REFERENCES backers(id);\n\n\n--\n-- Name: projects_category_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY projects\n ADD CONSTRAINT projects_category_id_reference FOREIGN KEY (category_id) REFERENCES categories(id);\n\n\n--\n-- Name: projects_user_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY projects\n ADD CONSTRAINT projects_user_id_reference FOREIGN KEY (user_id) REFERENCES users(id);\n\n\n--\n-- Name: rewards_project_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY rewards\n ADD CONSTRAINT rewards_project_id_reference FOREIGN KEY (project_id) REFERENCES projects(id);\n\n\n--\n-- Name: unsubscribes_notification_type_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY unsubscribes\n ADD CONSTRAINT unsubscribes_notification_type_id_fk FOREIGN KEY (notification_type_id) REFERENCES notification_types(id);\n\n\n--\n-- Name: unsubscribes_project_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY unsubscribes\n ADD CONSTRAINT unsubscribes_project_id_fk FOREIGN KEY (project_id) REFERENCES projects(id);\n\n\n--\n-- Name: unsubscribes_user_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY unsubscribes\n ADD CONSTRAINT unsubscribes_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);\n\n\n--\n-- Name: updates_project_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY updates\n ADD CONSTRAINT updates_project_id_fk FOREIGN KEY (project_id) REFERENCES projects(id);\n\n\n--\n-- Name: updates_user_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY updates\n ADD CONSTRAINT updates_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);\n\n\n--\n-- Name: users_primary_user_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -\n--\n\nALTER TABLE ONLY users\n ADD CONSTRAINT users_primary_user_id_reference FOREIGN KEY (primary_user_id) REFERENCES users(id);\n\n\n--\n-- Name: public; Type: ACL; Schema: -; Owner: -\n--\n\nREVOKE ALL ON SCHEMA public FROM PUBLIC;\nREVOKE ALL ON SCHEMA public FROM postgres;\nGRANT ALL ON SCHEMA public TO postgres;\nGRANT ALL ON SCHEMA public TO PUBLIC;\n\n\n--\n-- PostgreSQL database dump complete\n--\n")
  17. rake aborted!
  18. An error has occurred, this and all later migrations canceled:
  19.  
  20. PG::Error: ERROR: must be owner of extension plpgsql
  21. : --
  22. -- PostgreSQL database dump
  23. --
  24.  
  25. SET statement_timeout = 0;
  26. SET client_encoding = 'UTF8';
  27. SET standard_conforming_strings = on;
  28. SET check_function_bodies = false;
  29. SET client_min_messages = warning;
  30.  
  31. --
  32. -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
  33. --
  34.  
  35. CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
  36.  
  37.  
  38. --
  39. -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
  40. --
  41.  
  42. COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
  43.  
  44.  
  45. --
  46. -- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: -
  47. --
  48.  
  49. CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;
  50.  
  51.  
  52. --
  53. -- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: -
  54. --
  55.  
  56. COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';
  57.  
  58.  
  59. --
  60. -- Name: unaccent; Type: EXTENSION; Schema: -; Owner: -
  61. --
  62.  
  63. CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA public;
  64.  
  65.  
  66. --
  67. -- Name: EXTENSION unaccent; Type: COMMENT; Schema: -; Owner: -
  68. --
  69.  
  70. COMMENT ON EXTENSION unaccent IS 'text search dictionary that removes accents';
  71.  
  72.  
  73. SET search_path = public, pg_catalog;
  74.  
  75. SET default_tablespace = '';
  76.  
  77. SET default_with_oids = false;
  78.  
  79. --
  80. -- Name: active_admin_comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
  81. --
  82.  
  83. CREATE TABLE active_admin_comments (
  84. id integer NOT NULL,
  85. resource_id integer NOT NULL,
  86. resource_type character varying(255) NOT NULL,
  87. author_id integer,
  88. author_type character varying(255),
  89. body text,
  90. created_at timestamp without time zone,
  91. updated_at timestamp without time zone,
  92. namespace character varying(255)
  93. );
  94.  
  95.  
  96. --
  97. -- Name: admin_notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
  98. --
  99.  
  100. CREATE SEQUENCE admin_notes_id_seq
  101. START WITH 1
  102. INCREMENT BY 1
  103. NO MINVALUE
  104. NO MAXVALUE
  105. CACHE 1;
  106.  
  107.  
  108. --
  109. -- Name: admin_notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
  110. --
  111.  
  112. ALTER SEQUENCE admin_notes_id_seq OWNED BY active_admin_comments.id;
  113.  
  114.  
  115. --
  116. -- Name: institutional_videos; Type: TABLE; Schema: public; Owner: -; Tablespace:
  117. --
  118.  
  119. CREATE TABLE institutional_videos (
  120. id integer NOT NULL,
  121. title character varying(255),
  122. description text,
  123. video_url character varying(255),
  124. visible boolean,
  125. created_at timestamp without time zone,
  126. updated_at timestamp without time zone
  127. );
  128.  
  129.  
  130. --
  131. -- Name: advert_videos_id_seq; Type: SEQUENCE; Schema: public; Owner: -
  132. --
  133.  
  134. CREATE SEQUENCE advert_videos_id_seq
  135. START WITH 1
  136. INCREMENT BY 1
  137. NO MINVALUE
  138. NO MAXVALUE
  139. CACHE 1;
  140.  
  141.  
  142. --
  143. -- Name: advert_videos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
  144. --
  145.  
  146. ALTER SEQUENCE advert_videos_id_seq OWNED BY institutional_videos.id;
  147.  
  148.  
  149. --
  150. -- Name: backers; Type: TABLE; Schema: public; Owner: -; Tablespace:
  151. --
  152.  
  153. CREATE TABLE backers (
  154. id integer NOT NULL,
  155. project_id integer NOT NULL,
  156. user_id integer NOT NULL,
  157. reward_id integer,
  158. value numeric NOT NULL,
  159. confirmed boolean DEFAULT false NOT NULL,
  160. confirmed_at timestamp without time zone,
  161. created_at timestamp without time zone,
  162. updated_at timestamp without time zone,
  163. anonymous boolean DEFAULT false,
  164. key text,
  165. requested_refund boolean DEFAULT false,
  166. refunded boolean DEFAULT false,
  167. credits boolean DEFAULT false,
  168. notified_finish boolean DEFAULT false,
  169. payment_method text,
  170. payment_token text,
  171. payment_id character varying(255),
  172. payer_name text,
  173. payer_email text,
  174. payer_document text,
  175. address_street text,
  176. address_number text,
  177. address_complement text,
  178. address_neighbourhood text,
  179. address_zip_code text,
  180. address_city text,
  181. address_state text,
  182. address_phone_number text,
  183. payment_choice text,
  184. payment_service_fee numeric,
  185. CONSTRAINT backers_value_positive CHECK ((value >= (0)::numeric))
  186. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement