SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- Name: rssj; Type: SCHEMA; Schema: -; Owner: rssj_admin
--

CREATE SCHEMA rssj;


ALTER SCHEMA rssj OWNER TO rssj_admin;

--
-- 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 default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: catalog; Type: TABLE; Schema: rssj; Owner: rssj_admin
--

CREATE TABLE rssj.catalog (
    catalog_id bigint NOT NULL,
    category text,
    tag text,
    name text,
    apply_to text
);


ALTER TABLE rssj.catalog OWNER TO rssj_admin;

--
-- Name: corpus_frequency; Type: TABLE; Schema: rssj; Owner: rssj_admin
--

CREATE TABLE rssj.corpus_frequency (
    corpus_frequency_id bigint NOT NULL,
    sense_id bigint,
    frequency bigint,
    corpus text,
    freq_per_milion numeric,
    rank bigint
);


ALTER TABLE rssj.corpus_frequency OWNER TO rssj_admin;

--
-- Name: corpus_frequency_corpus_frequency_id_seq; Type: SEQUENCE; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE rssj.corpus_frequency ALTER COLUMN corpus_frequency_id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME rssj.corpus_frequency_corpus_frequency_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: definition; Type: TABLE; Schema: rssj; Owner: rssj_admin
--

CREATE TABLE rssj.definition (
    definition_id bigint NOT NULL,
    sense_id bigint,
    type text,
    listing_order bigint,
    text text
);


ALTER TABLE rssj.definition OWNER TO rssj_admin;

--
-- Name: definition_definition_id_seq; Type: SEQUENCE; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE rssj.definition ALTER COLUMN definition_id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME rssj.definition_definition_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: entry; Type: TABLE; Schema: rssj; Owner: rssj_admin
--

CREATE TABLE rssj.entry (
    entry_id bigint NOT NULL,
    headwords_acc text[],
    headwords text[],
    pos text,
    homograph_number bigint,
    type text,
    rank bigint,
    frequency_phm bigint,
    headwords_acc_ijk text[]
);


ALTER TABLE rssj.entry OWNER TO rssj_admin;

--
-- Name: estatus; Type: TABLE; Schema: rssj; Owner: rssj_admin
--

CREATE TABLE rssj.estatus (
    estatus_id bigint NOT NULL,
    username text,
    estatus text,
    edate date,
    entry_id bigint,
    active bit(1)
);


ALTER TABLE rssj.estatus OWNER TO rssj_admin;

--
-- Name: estatus_estatus_id_seq; Type: SEQUENCE; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE rssj.estatus ALTER COLUMN estatus_id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME rssj.estatus_estatus_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: example; Type: TABLE; Schema: rssj; Owner: rssj_admin
--

CREATE TABLE rssj.example (
    example_id bigint NOT NULL,
    sense_id bigint,
    listing_order bigint,
    label text,
    text text,
    type text,
    start_index bigint,
    end_index bigint,
    locus text
);


ALTER TABLE rssj.example OWNER TO rssj_admin;

--
-- Name: example_example_id_seq; Type: SEQUENCE; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE rssj.example ALTER COLUMN example_id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME rssj.example_example_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: grammar; Type: TABLE; Schema: rssj; Owner: rssj_admin
--

CREATE TABLE rssj.grammar (
    grammar_id bigint NOT NULL,
    sense_id bigint,
    tag text,
    text text,
    listing_order bigint
);


ALTER TABLE rssj.grammar OWNER TO rssj_admin;

--
-- Name: grammar_grammar_id_seq; Type: SEQUENCE; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE rssj.grammar ALTER COLUMN grammar_id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME rssj.grammar_grammar_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: lexicon; Type: TABLE; Schema: rssj; Owner: rssj_admin
--

CREATE TABLE rssj.lexicon (
    lexicon_id bigint NOT NULL,
    name text NOT NULL,
    description text
);


ALTER TABLE rssj.lexicon OWNER TO rssj_admin;

--
-- Name: member; Type: TABLE; Schema: rssj; Owner: rssj_admin
--

CREATE TABLE rssj.member (
    member_id bigint NOT NULL,
    relation_id bigint,
    member_sense_id bigint,
    role text,
    listing_order bigint,
    obverse_listing_order bigint
);


ALTER TABLE rssj.member OWNER TO rssj_admin;

--
-- Name: member_member_id_seq; Type: SEQUENCE; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE rssj.member ALTER COLUMN member_id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME rssj.member_member_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: note; Type: TABLE; Schema: rssj; Owner: rssj_admin
--

CREATE TABLE rssj.note (
    note_id bigint NOT NULL,
    entry_id bigint,
    type text,
    note text,
    author text
);


ALTER TABLE rssj.note OWNER TO rssj_admin;

--
-- Name: note_note_id_seq; Type: SEQUENCE; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE rssj.note ALTER COLUMN note_id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME rssj.note_note_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: pronunciation; Type: TABLE; Schema: rssj; Owner: rssj_admin
--

CREATE TABLE rssj.pronunciation (
    pronunciation_id bigint NOT NULL,
    "soundFile" text,
    entry_id bigint,
    listing_order bigint,
    labels text[],
    transkriptions text[],
    headword text,
    username text
);


ALTER TABLE rssj.pronunciation OWNER TO rssj_admin;

--
-- Name: pronunciation_pronunciation_id_seq; Type: SEQUENCE; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE rssj.pronunciation ALTER COLUMN pronunciation_id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME rssj.pronunciation_pronunciation_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: relation; Type: TABLE; Schema: rssj; Owner: rssj_admin
--

CREATE TABLE rssj.relation (
    relation_id bigint NOT NULL,
    type text,
    description text,
    lexicon_id bigint,
    listing_order bigint
);


ALTER TABLE rssj.relation OWNER TO rssj_admin;

--
-- Name: relation_relation_id_seq; Type: SEQUENCE; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE rssj.relation ALTER COLUMN relation_id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME rssj.relation_relation_id_seq
    START WITH 10
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sense; Type: TABLE; Schema: rssj; Owner: rssj_admin
--

CREATE TABLE rssj.sense (
    sense_id bigint NOT NULL,
    entry_id bigint,
    listing_order bigint,
    sense_label text,
    domains text[],
    qualifiers text[],
    collocations text[],
    indicator text,
    grammar text,
    grammar_ijk text
);


ALTER TABLE rssj.sense OWNER TO rssj_admin;

--
-- Name: sense_sense_id_seq; Type: SEQUENCE; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE rssj.sense ALTER COLUMN sense_id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME rssj.sense_sense_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: test; Type: TABLE; Schema: rssj; Owner: rssj_admin
--

CREATE TABLE rssj.test (
    id int4range
);


ALTER TABLE rssj.test OWNER TO rssj_admin;

--
-- Name: catalog catalog_pkey; Type: CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.catalog
    ADD CONSTRAINT catalog_pkey PRIMARY KEY (catalog_id);


--
-- Name: definition definition_pkey; Type: CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.definition
    ADD CONSTRAINT definition_pkey PRIMARY KEY (definition_id);


--
-- Name: entry entry_pkey; Type: CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.entry
    ADD CONSTRAINT entry_pkey PRIMARY KEY (entry_id);


--
-- Name: estatus estatus_pkey; Type: CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.estatus
    ADD CONSTRAINT estatus_pkey PRIMARY KEY (estatus_id);


--
-- Name: grammar grammar_pkey; Type: CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.grammar
    ADD CONSTRAINT grammar_pkey PRIMARY KEY (grammar_id);


--
-- Name: sense lex_comp_sense_pkey; Type: CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.sense
    ADD CONSTRAINT lex_comp_sense_pkey PRIMARY KEY (sense_id);


--
-- Name: corpus_frequency lex_component_pkey; Type: CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.corpus_frequency
    ADD CONSTRAINT lex_component_pkey PRIMARY KEY (corpus_frequency_id);


--
-- Name: lexicon lexicon_pkey; Type: CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.lexicon
    ADD CONSTRAINT lexicon_pkey PRIMARY KEY (lexicon_id);


--
-- Name: member member_pkey; Type: CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.member
    ADD CONSTRAINT member_pkey PRIMARY KEY (member_id);


--
-- Name: note note_pkey; Type: CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.note
    ADD CONSTRAINT note_pkey PRIMARY KEY (note_id);


--
-- Name: pronunciation pronunciation_pkey; Type: CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.pronunciation
    ADD CONSTRAINT pronunciation_pkey PRIMARY KEY (pronunciation_id);


--
-- Name: relation relation_pkey; Type: CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.relation
    ADD CONSTRAINT relation_pkey PRIMARY KEY (relation_id);


--
-- Name: estatus fk_entry_estatus; Type: FK CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.estatus
    ADD CONSTRAINT fk_entry_estatus FOREIGN KEY (entry_id) REFERENCES rssj.entry(entry_id) NOT VALID;


--
-- Name: note fk_entry_note; Type: FK CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.note
    ADD CONSTRAINT fk_entry_note FOREIGN KEY (entry_id) REFERENCES rssj.entry(entry_id) NOT VALID;


--
-- Name: pronunciation fk_entry_pronunciation; Type: FK CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.pronunciation
    ADD CONSTRAINT fk_entry_pronunciation FOREIGN KEY (entry_id) REFERENCES rssj.entry(entry_id) NOT VALID;


--
-- Name: sense fk_entry_sense; Type: FK CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.sense
    ADD CONSTRAINT fk_entry_sense FOREIGN KEY (entry_id) REFERENCES rssj.entry(entry_id) NOT VALID;


--
-- Name: definition fk_sense_definition; Type: FK CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.definition
    ADD CONSTRAINT fk_sense_definition FOREIGN KEY (sense_id) REFERENCES rssj.sense(sense_id) NOT VALID;


--
-- Name: example fk_sense_example; Type: FK CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.example
    ADD CONSTRAINT fk_sense_example FOREIGN KEY (sense_id) REFERENCES rssj.sense(sense_id) NOT VALID;


--
-- Name: corpus_frequency fk_sense_frequency; Type: FK CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.corpus_frequency
    ADD CONSTRAINT fk_sense_frequency FOREIGN KEY (sense_id) REFERENCES rssj.sense(sense_id) NOT VALID;


--
-- Name: grammar fk_sense_grammar; Type: FK CONSTRAINT; Schema: rssj; Owner: rssj_admin
--

ALTER TABLE ONLY rssj.grammar
    ADD CONSTRAINT fk_sense_grammar FOREIGN KEY (sense_id) REFERENCES rssj.sense(sense_id) NOT VALID;

