 
 
 --
+-- Name: eu_4890_listing_changes_mview; Type: TABLE; Schema: public; Owner: -; Tablespace: 
+--
+
+CREATE TABLE eu_4890_listing_changes_mview (
+    taxon_concept_id integer,
+    id integer,
+    original_taxon_concept_id integer,
+    effective_at timestamp without time zone,
+    species_listing_id integer,
+    species_listing_name character varying(255),
+    change_type_id integer,
+    change_type_name character varying(255),
+    designation_id integer,
+    designation_name character varying(255),
+    parent_id integer,
+    nomenclature_note_en text,
+    nomenclature_note_fr text,
+    nomenclature_note_es text,
+    party_id integer,
+    party_iso_code character varying(255),
+    party_full_name_en character varying(255),
+    party_full_name_es character varying(255),
+    party_full_name_fr character varying(255),
+    ann_symbol character varying(255),
+    full_note_en text,
+    full_note_es text,
+    full_note_fr text,
+    short_note_en text,
+    short_note_es text,
+    short_note_fr text,
+    display_in_index boolean,
+    display_in_footnote boolean,
+    hash_ann_symbol character varying(255),
+    hash_ann_parent_symbol character varying(255),
+    hash_full_note_en text,
+    hash_full_note_es text,
+    hash_full_note_fr text,
+    inclusion_taxon_concept_id integer,
+    inherited_short_note_en text,
+    inherited_full_note_en text,
+    inherited_short_note_es text,
+    inherited_full_note_es text,
+    inherited_short_note_fr text,
+    inherited_full_note_fr text,
+    auto_note_en text,
+    auto_note_es text,
+    auto_note_fr text,
+    is_current boolean,
+    explicit_change boolean,
+    updated_at timestamp without time zone,
+    show_in_history boolean,
+    show_in_downloads boolean,
+    show_in_timeline boolean,
+    listed_geo_entities_ids integer[],
+    excluded_geo_entities_ids integer[],
+    excluded_taxon_concept_ids integer[],
+    dirty boolean,
+    expiry timestamp with time zone
+);
+
+
+--
 -- Name: eu_decision_confirmations; Type: TABLE; Schema: public; Owner: -; Tablespace: 
 --
 



SET search_path = public, pg_catalog;

--
-- Name: api_annotation; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE api_annotation AS (
	symbol text,
	note text
);


--
-- Name: api_eu_decision_type; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE api_eu_decision_type AS (
	name text,
	description text,
	type text
);


--
-- Name: api_event; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE api_event AS (
	name text,
	date date,
	url text
);


--
-- Name: api_geo_entity; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE api_geo_entity AS (
	iso_code2 text,
	name text,
	type text
);


--
-- Name: api_higher_taxa; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE api_higher_taxa AS (
	kingdom text,
	phylum text,
	class text,
	"order" text,
	family text
);


--
-- Name: api_taxon_concept; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE api_taxon_concept AS (
	id integer,
	full_name text,
	author_year text,
	rank text
);


--
-- Name: api_trade_code; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE api_trade_code AS (
	code text,
	name text
);


SET default_tablespace = '';


      RAISE INFO 'Swapping eu_listing_changes materialized view';
      EXECUTE 'DROP TABLE IF EXISTS ' || listing_changes_mview || ' CASCADE';
      EXECUTE 'ALTER TABLE ' || tmp_listing_changes_mview || ' RENAME TO ' || listing_changes_mview;
    END IF;
  END;
  $$;
