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

-- Table: country
CREATE TABLE "bird__cars"."country" (
    "origin" BIGINT NOT NULL,
    "country" TEXT,
    CONSTRAINT "country_pkey" PRIMARY KEY ("origin")
);

-- Table: data
CREATE TABLE "bird__cars"."data" (
    "ID" BIGINT NOT NULL,
    "mpg" DOUBLE PRECISION,
    "cylinders" BIGINT,
    "displacement" DOUBLE PRECISION,
    "horsepower" BIGINT,
    "weight" BIGINT,
    "acceleration" DOUBLE PRECISION,
    "model" BIGINT,
    "car_name" TEXT,
    CONSTRAINT "data_pkey" PRIMARY KEY ("ID")
);

-- Table: price
CREATE TABLE "bird__cars"."price" (
    "ID" BIGINT NOT NULL,
    "price" DOUBLE PRECISION,
    CONSTRAINT "price_pkey" PRIMARY KEY ("ID")
);

-- Table: production
CREATE TABLE "bird__cars"."production" (
    "ID" BIGINT NOT NULL,
    "model_year" BIGINT NOT NULL,
    "country" BIGINT,
    CONSTRAINT "production_pkey" PRIMARY KEY ("ID", "model_year")
);

-- Foreign Keys
ALTER TABLE "bird__cars"."data" ADD CONSTRAINT "fk_data_0" FOREIGN KEY ("ID") REFERENCES "bird__cars"."price" ("ID") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "bird__cars"."production" ADD CONSTRAINT "fk_production_0" FOREIGN KEY ("ID") REFERENCES "bird__cars"."price" ("ID") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "bird__cars"."production" ADD CONSTRAINT "fk_production_1" FOREIGN KEY ("ID") REFERENCES "bird__cars"."data" ("ID") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "bird__cars"."production" ADD CONSTRAINT "fk_production_2" FOREIGN KEY ("country") REFERENCES "bird__cars"."country" ("origin") ON DELETE NO ACTION ON UPDATE NO ACTION;
