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

-- Table: Classification
CREATE TABLE "bird__genes"."Classification" (
    "GeneID" TEXT NOT NULL,
    "Localization" TEXT NOT NULL,
    CONSTRAINT "Classification_pkey" PRIMARY KEY ("GeneID")
);

-- Table: Genes
CREATE TABLE "bird__genes"."Genes" (
    "GeneID" TEXT NOT NULL,
    "Essential" TEXT NOT NULL,
    "Class" TEXT NOT NULL,
    "Complex" TEXT,
    "Phenotype" TEXT NOT NULL,
    "Motif" TEXT NOT NULL,
    "Chromosome" BIGINT NOT NULL,
    "Function" TEXT NOT NULL,
    "Localization" TEXT NOT NULL
);

-- Table: Interactions
CREATE TABLE "bird__genes"."Interactions" (
    "GeneID1" TEXT NOT NULL,
    "GeneID2" TEXT NOT NULL,
    "Type" TEXT NOT NULL,
    "Expression_Corr" DOUBLE PRECISION NOT NULL,
    CONSTRAINT "Interactions_pkey" PRIMARY KEY ("GeneID1", "GeneID2")
);

-- Foreign Keys
ALTER TABLE "bird__genes"."Genes" ADD CONSTRAINT "fk_Genes_0" FOREIGN KEY ("GeneID") REFERENCES "bird__genes"."Classification" ("GeneID") ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE "bird__genes"."Interactions" ADD CONSTRAINT "fk_Interactions_0" FOREIGN KEY ("GeneID2") REFERENCES "bird__genes"."Classification" ("GeneID") ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE "bird__genes"."Interactions" ADD CONSTRAINT "fk_Interactions_1" FOREIGN KEY ("GeneID1") REFERENCES "bird__genes"."Classification" ("GeneID") ON DELETE CASCADE ON UPDATE CASCADE;
