-- Schema: bird__legislator
CREATE SCHEMA IF NOT EXISTS "bird__legislator";

-- Table: current
CREATE TABLE "bird__legislator"."current" (
    "ballotpedia_id" TEXT,
    "bioguide_id" TEXT,
    "birthday_bio" DATE,
    "cspan_id" DOUBLE PRECISION,
    "fec_id" TEXT,
    "first_name" TEXT,
    "gender_bio" TEXT,
    "google_entity_id_id" TEXT,
    "govtrack_id" BIGINT,
    "house_history_id" DOUBLE PRECISION,
    "icpsr_id" DOUBLE PRECISION,
    "last_name" TEXT,
    "lis_id" TEXT,
    "maplight_id" DOUBLE PRECISION,
    "middle_name" TEXT,
    "nickname_name" TEXT,
    "official_full_name" TEXT,
    "opensecrets_id" TEXT,
    "religion_bio" TEXT,
    "suffix_name" TEXT,
    "thomas_id" BIGINT,
    "votesmart_id" DOUBLE PRECISION,
    "wikidata_id" TEXT,
    "wikipedia_id" TEXT
);

-- Table: current-terms
CREATE TABLE "bird__legislator"."current-terms" (
    "address" TEXT,
    "bioguide" TEXT,
    "caucus" TEXT,
    "chamber" TEXT,
    "class" DOUBLE PRECISION,
    "contact_form" TEXT,
    "district" DOUBLE PRECISION,
    "end" TEXT,
    "fax" TEXT,
    "last" TEXT,
    "name" TEXT,
    "office" TEXT,
    "party" TEXT,
    "party_affiliations" TEXT,
    "phone" TEXT,
    "relation" TEXT,
    "rss_url" TEXT,
    "start" TEXT,
    "state" TEXT,
    "state_rank" TEXT,
    "title" TEXT,
    "type" TEXT,
    "url" TEXT
);

-- Table: historical
CREATE TABLE "bird__legislator"."historical" (
    "ballotpedia_id" TEXT,
    "bioguide_id" TEXT NOT NULL,
    "bioguide_previous_id" TEXT,
    "birthday_bio" TEXT,
    "cspan_id" TEXT,
    "fec_id" TEXT,
    "first_name" TEXT,
    "gender_bio" TEXT,
    "google_entity_id_id" TEXT,
    "govtrack_id" BIGINT,
    "house_history_alternate_id" TEXT,
    "house_history_id" DOUBLE PRECISION,
    "icpsr_id" DOUBLE PRECISION,
    "last_name" TEXT,
    "lis_id" TEXT,
    "maplight_id" TEXT,
    "middle_name" TEXT,
    "nickname_name" TEXT,
    "official_full_name" TEXT,
    "opensecrets_id" TEXT,
    "religion_bio" TEXT,
    "suffix_name" TEXT,
    "thomas_id" TEXT,
    "votesmart_id" TEXT,
    "wikidata_id" TEXT,
    "wikipedia_id" TEXT,
    CONSTRAINT "historical_pkey" PRIMARY KEY ("bioguide_id")
);

-- Table: historical-terms
CREATE TABLE "bird__legislator"."historical-terms" (
    "address" TEXT,
    "bioguide" TEXT NOT NULL,
    "chamber" TEXT,
    "class" DOUBLE PRECISION,
    "contact_form" TEXT,
    "district" DOUBLE PRECISION,
    "end" TEXT,
    "fax" TEXT,
    "last" TEXT,
    "middle" TEXT,
    "name" TEXT,
    "office" TEXT,
    "party" TEXT,
    "party_affiliations" TEXT,
    "phone" TEXT,
    "relation" TEXT,
    "rss_url" TEXT,
    "start" TEXT,
    "state" TEXT,
    "state_rank" TEXT,
    "title" TEXT,
    "type" TEXT,
    "url" TEXT,
    CONSTRAINT "historical-terms_pkey" PRIMARY KEY ("bioguide")
);

-- Table: social-media
CREATE TABLE "bird__legislator"."social-media" (
    "bioguide" TEXT NOT NULL,
    "facebook" TEXT,
    "facebook_id" DOUBLE PRECISION,
    "govtrack" DOUBLE PRECISION,
    "instagram" TEXT,
    "instagram_id" DOUBLE PRECISION,
    "thomas" BIGINT,
    "twitter" TEXT,
    "twitter_id" DOUBLE PRECISION,
    "youtube" TEXT,
    "youtube_id" TEXT,
    CONSTRAINT "social-media_pkey" PRIMARY KEY ("bioguide")
);

-- Foreign Keys
ALTER TABLE "bird__legislator"."historical-terms" ADD CONSTRAINT "fk_historical-terms_0" FOREIGN KEY ("bioguide") REFERENCES "bird__legislator"."historical" ("bioguide_id") ON DELETE NO ACTION ON UPDATE NO ACTION;
